//  ********** Library dart:core **************
//  ********** Natives dart:core **************
function $defProp(obj, prop, value) {
  Object.defineProperty(obj, prop,
      {value: value, enumerable: false, writable: true, configurable: true});
}
function $throw(e) {
  // If e is not a value, we can use V8's captureStackTrace utility method.
  // TODO(jmesserly): capture the stack trace on other JS engines.
  if (e && (typeof e == 'object') && Error.captureStackTrace) {
    // TODO(jmesserly): this will clobber the e.stack property
    Error.captureStackTrace(e, $throw);
  }
  throw e;
}
$defProp(Object.prototype, '$index', function(i) {
  $throw(new NoSuchMethodException(this, "operator []", [i]));
});
$defProp(Array.prototype, '$index', function(index) {
  var i = index | 0;
  if (i !== index) {
    throw new IllegalArgumentException('index is not int');
  } else if (i < 0 || i >= this.length) {
    throw new IndexOutOfRangeException(index);
  }
  return this[i];
});
$defProp(String.prototype, '$index', function(i) {
  return this[i];
});
$defProp(Object.prototype, '$setindex', function(i, value) {
  $throw(new NoSuchMethodException(this, "operator []=", [i, value]));
});
$defProp(Array.prototype, '$setindex', function(index, value) {
  var i = index | 0;
  if (i !== index) {
    throw new IllegalArgumentException('index is not int');
  } else if (i < 0 || i >= this.length) {
    throw new IndexOutOfRangeException(index);
  }
  return this[i] = value;
});
function $add$complex$(x, y) {
  if (typeof(x) == 'number') {
    $throw(new IllegalArgumentException(y));
  } else if (typeof(x) == 'string') {
    var str = (y == null) ? 'null' : y.toString();
    if (typeof(str) != 'string') {
      throw new Error("calling toString() on right hand operand of operator " +
      "+ did not return a String");
    }
    return x + str;
  } else if (typeof(x) == 'object') {
    return x.$add(y);
  } else {
    $throw(new NoSuchMethodException(x, "operator +", [y]));
  }
}

function $add$(x, y) {
  if (typeof(x) == 'number' && typeof(y) == 'number') return x + y;
  return $add$complex$(x, y);
}
function $eq$(x, y) {
  if (x == null) return y == null;
  return (typeof(x) != 'object') ? x === y : x.$eq(y);
}
// TODO(jimhug): Should this or should it not match equals?
$defProp(Object.prototype, '$eq', function(other) {
  return this === other;
});
function $ne$(x, y) {
  if (x == null) return y != null;
  return (typeof(x) != 'object') ? x !== y : !x.$eq(y);
}
function $truncdiv$(x, y) {
  if (typeof(x) == 'number') {
    if (typeof(y) == 'number') {
      if (y == 0) $throw(new IntegerDivisionByZeroException());
      var tmp = x / y;
      return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);
    } else {
      $throw(new IllegalArgumentException(y));
    }
  } else if (typeof(x) == 'object') {
    return x.$truncdiv(y);
  } else {
    $throw(new NoSuchMethodException(x, "operator ~/", [y]));
  }
}
// ********** Code for Object **************
$defProp(Object.prototype, "noSuchMethod", function(name, args) {
  $throw(new NoSuchMethodException(this, name, args));
});
$defProp(Object.prototype, "add$1", function($0) {
  return this.noSuchMethod("add", [$0]);
});
$defProp(Object.prototype, "clear$0", function() {
  return this.noSuchMethod("clear", []);
});
$defProp(Object.prototype, "is$Collection", function() {
  return false;
});
$defProp(Object.prototype, "is$Exception", function() {
  return false;
});
$defProp(Object.prototype, "is$List", function() {
  return false;
});
$defProp(Object.prototype, "is$Map", function() {
  return false;
});
$defProp(Object.prototype, "is$Map_dart_core_String$Dynamic", function() {
  return false;
});
$defProp(Object.prototype, "is$html_Element", function() {
  return false;
});
$defProp(Object.prototype, "remove$0", function() {
  return this.noSuchMethod("remove", []);
});
// ********** Code for IndexOutOfRangeException **************
function IndexOutOfRangeException(_index) {
  this._index = _index;
}
IndexOutOfRangeException.prototype.is$IndexOutOfRangeException = function(){return true};
IndexOutOfRangeException.prototype.is$Exception = function(){return true};
IndexOutOfRangeException.prototype.toString = function() {
  return ("IndexOutOfRangeException: " + this._index);
}
// ********** Code for NoSuchMethodException **************
function NoSuchMethodException(_receiver, _functionName, _arguments, _existingArgumentNames) {
  this._receiver = _receiver;
  this._functionName = _functionName;
  this._arguments = _arguments;
  this._existingArgumentNames = _existingArgumentNames;
}
NoSuchMethodException.prototype.is$NoSuchMethodException = function(){return true};
NoSuchMethodException.prototype.is$Exception = function(){return true};
NoSuchMethodException.prototype.toString = function() {
  var sb = new StringBufferImpl("");
  for (var i = (0);
   i < this._arguments.get$length(); i++) {
    if (i > (0)) {
      sb.add(", ");
    }
    sb.add(this._arguments.$index(i));
  }
  if (null == this._existingArgumentNames) {
    return (("NoSuchMethodException : method not found: '" + this._functionName + "'\n") + ("Receiver: " + this._receiver + "\n") + ("Arguments: [" + sb + "]"));
  }
  else {
    var actualParameters = sb.toString();
    sb = new StringBufferImpl("");
    for (var i = (0);
     i < this._existingArgumentNames.get$length(); i++) {
      if (i > (0)) {
        sb.add(", ");
      }
      sb.add(this._existingArgumentNames.$index(i));
    }
    var formalParameters = sb.toString();
    return ("NoSuchMethodException: incorrect number of arguments passed to " + ("method named '" + this._functionName + "'\nReceiver: " + this._receiver + "\n") + ("Tried calling: " + this._functionName + "(" + actualParameters + ")\n") + ("Found: " + this._functionName + "(" + formalParameters + ")"));
  }
}
// ********** Code for ClosureArgumentMismatchException **************
function ClosureArgumentMismatchException() {

}
ClosureArgumentMismatchException.prototype.is$Exception = function(){return true};
ClosureArgumentMismatchException.prototype.toString = function() {
  return "Closure argument mismatch";
}
// ********** Code for ObjectNotClosureException **************
function ObjectNotClosureException() {

}
ObjectNotClosureException.prototype.is$Exception = function(){return true};
ObjectNotClosureException.prototype.toString = function() {
  return "Object is not closure";
}
// ********** Code for IllegalArgumentException **************
function IllegalArgumentException(arg) {
  this._arg = arg;
}
IllegalArgumentException.prototype.is$IllegalArgumentException = function(){return true};
IllegalArgumentException.prototype.is$Exception = function(){return true};
IllegalArgumentException.prototype.toString = function() {
  return ("Illegal argument(s): " + this._arg);
}
// ********** Code for StackOverflowException **************
function StackOverflowException() {

}
StackOverflowException.prototype.is$Exception = function(){return true};
StackOverflowException.prototype.toString = function() {
  return "Stack Overflow";
}
// ********** Code for BadNumberFormatException **************
function BadNumberFormatException(_s) {
  this._s = _s;
}
BadNumberFormatException.prototype.is$Exception = function(){return true};
BadNumberFormatException.prototype.toString = function() {
  return ("BadNumberFormatException: '" + this._s + "'");
}
// ********** Code for NullPointerException **************
function NullPointerException() {

}
NullPointerException.prototype.is$Exception = function(){return true};
NullPointerException.prototype.toString = function() {
  return "NullPointerException";
}
// ********** Code for NoMoreElementsException **************
function NoMoreElementsException() {

}
NoMoreElementsException.prototype.is$Exception = function(){return true};
NoMoreElementsException.prototype.toString = function() {
  return "NoMoreElementsException";
}
// ********** Code for EmptyQueueException **************
function EmptyQueueException() {

}
EmptyQueueException.prototype.is$Exception = function(){return true};
EmptyQueueException.prototype.toString = function() {
  return "EmptyQueueException";
}
// ********** Code for UnsupportedOperationException **************
function UnsupportedOperationException(_message) {
  this._message = _message;
}
UnsupportedOperationException.prototype.is$Exception = function(){return true};
UnsupportedOperationException.prototype.toString = function() {
  return ("UnsupportedOperationException: " + this._message);
}
// ********** Code for NotImplementedException **************
function NotImplementedException() {

}
NotImplementedException.prototype.is$Exception = function(){return true};
NotImplementedException.prototype.toString = function() {
  return "NotImplementedException";
}
// ********** Code for IntegerDivisionByZeroException **************
function IntegerDivisionByZeroException() {

}
IntegerDivisionByZeroException.prototype.is$IntegerDivisionByZeroException = function(){return true};
IntegerDivisionByZeroException.prototype.is$Exception = function(){return true};
IntegerDivisionByZeroException.prototype.toString = function() {
  return "IntegerDivisionByZeroException";
}
// ********** Code for dart_core_Function **************
Function.prototype.to$call$0 = function() {
  this.call$0 = this._genStub(0);
  this.to$call$0 = function() { return this.call$0; };
  return this.call$0;
};
Function.prototype.call$0 = function() {
  return this.to$call$0()();
};
function to$call$0(f) { return f && f.to$call$0(); }
Function.prototype.to$call$1 = function() {
  this.call$1 = this._genStub(1);
  this.to$call$1 = function() { return this.call$1; };
  return this.call$1;
};
Function.prototype.call$1 = function($0) {
  return this.to$call$1()($0);
};
function to$call$1(f) { return f && f.to$call$1(); }
Function.prototype.to$call$2 = function() {
  this.call$2 = this._genStub(2);
  this.to$call$2 = function() { return this.call$2; };
  return this.call$2;
};
Function.prototype.call$2 = function($0, $1) {
  return this.to$call$2()($0, $1);
};
function to$call$2(f) { return f && f.to$call$2(); }
// ********** Code for Math **************
Math.parseInt = function(str) {
    var match = /^\s*[+-]?(?:(0[xX][abcdefABCDEF0-9]+)|\d+)\s*$/.exec(str);
    if (!match) $throw(new BadNumberFormatException(str));
    var isHex = !!match[1];
    var ret = parseInt(str, isHex ? 16 : 10);
    if (isNaN(ret)) $throw(new BadNumberFormatException(str));
    return ret;
}
// ********** Code for top level **************
function _toDartException(e) {
  function attachStack(dartEx) {
    // TODO(jmesserly): setting the stack property is not a long term solution.
    var stack = e.stack;
    // The stack contains the error message, and the stack is all that is
    // printed (the exception's toString() is never called).  Make the Dart
    // exception's toString() be the dominant message.
    if (typeof stack == 'string') {
      var message = dartEx.toString();
      if (/^(Type|Range)Error:/.test(stack)) {
        // Indent JS message (it can be helpful) so new message stands out.
        stack = '    (' + stack.substring(0, stack.indexOf('\n')) + ')\n' +
                stack.substring(stack.indexOf('\n') + 1);
      }
      stack = message + '\n' + stack;
    }
    dartEx.stack = stack;
    return dartEx;
  }

  if (e instanceof TypeError) {
    switch(e.type) {
      case 'property_not_function':
      case 'called_non_callable':
        if (e.arguments[0] == null) {
          return attachStack(new NullPointerException());
        } else {
          return attachStack(new ObjectNotClosureException());
        }
        break;
      case 'non_object_property_call':
      case 'non_object_property_load':
        return attachStack(new NullPointerException());
        break;
      case 'undefined_method':
        var mname = e.arguments[0];
        if (typeof(mname) == 'string' && (mname.indexOf('call$') == 0
            || mname == 'call' || mname == 'apply')) {
          return attachStack(new ObjectNotClosureException());
        } else {
          // TODO(jmesserly): fix noSuchMethod on operators so we don't hit this
          return attachStack(new NoSuchMethodException('', e.arguments[0], []));
        }
        break;
    }
  } else if (e instanceof RangeError) {
    if (e.message.indexOf('call stack') >= 0) {
      return attachStack(new StackOverflowException());
    }
  }
  return e;
}
//  ********** Library dart:coreimpl **************
// ********** Code for ListFactory **************
ListFactory = Array;
$defProp(ListFactory.prototype, "is$List", function(){return true});
$defProp(ListFactory.prototype, "is$Collection", function(){return true});
ListFactory.ListFactory$from$factory = function(other) {
  var list = [];
  for (var $$i = other.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    list.add$1(e);
  }
  return list;
}
$defProp(ListFactory.prototype, "get$length", function() { return this.length; });
$defProp(ListFactory.prototype, "set$length", function(value) { return this.length = value; });
$defProp(ListFactory.prototype, "add", function(value) {
  this.push(value);
});
$defProp(ListFactory.prototype, "addAll", function(collection) {
  for (var $$i = collection.iterator(); $$i.hasNext(); ) {
    var item = $$i.next();
    this.add(item);
  }
});
$defProp(ListFactory.prototype, "clear", function() {
  this.set$length((0));
});
$defProp(ListFactory.prototype, "removeLast", function() {
  return this.pop();
});
$defProp(ListFactory.prototype, "last", function() {
  return this.$index(this.get$length() - (1));
});
$defProp(ListFactory.prototype, "getRange", function(start, length) {
  
      if (length == 0) return [];
      if (length < 0) throw new IllegalArgumentException('length');
      if (start < 0 || start + length > this.length)
        throw new IndexOutOfRangeException(start);
      return this.slice(start, start + length);
    
});
$defProp(ListFactory.prototype, "removeRange", function(start, length) {
  
      if (length == 0) return;
      if (length < 0) throw new IllegalArgumentException('length');
      if (start < 0 || start + length > this.length)
        throw new IndexOutOfRangeException(start);
      this.splice(start, length);
    
});
$defProp(ListFactory.prototype, "isEmpty", function() {
  return this.get$length() == (0);
});
$defProp(ListFactory.prototype, "iterator", function() {
  return new ListIterator(this);
});
$defProp(ListFactory.prototype, "toString", function() {
  return Collections.collectionToString(this);
});
$defProp(ListFactory.prototype, "add$1", ListFactory.prototype.add);
$defProp(ListFactory.prototype, "clear$0", ListFactory.prototype.clear);
// ********** Code for ListIterator **************
function ListIterator(array) {
  this._array = array;
  this._pos = (0);
}
ListIterator.prototype.hasNext = function() {
  return this._array.get$length() > this._pos;
}
ListIterator.prototype.next = function() {
  if (!this.hasNext()) {
    $throw(const$0001);
  }
  return this._array.$index(this._pos++);
}
// ********** Code for NumImplementation **************
NumImplementation = Number;
NumImplementation.prototype.abs = function() {
  'use strict'; return Math.abs(this);
}
NumImplementation.prototype.hashCode = function() {
  'use strict'; return this & 0x1FFFFFFF;
}
NumImplementation.prototype.toInt = function() {
  
    'use strict';
    if (isNaN(this)) $throw(new BadNumberFormatException("NaN"));
    if ((this == Infinity) || (this == -Infinity)) {
      $throw(new BadNumberFormatException("Infinity"));
    }
    var truncated = (this < 0) ? Math.ceil(this) : Math.floor(this);
    if (truncated == -0.0) return 0;
    return truncated;
}
// ********** Code for Collections **************
function Collections() {}
Collections.collectionToString = function(c) {
  var result = new StringBufferImpl("");
  Collections._emitCollection(c, result, new Array());
  return result.toString();
}
Collections._emitCollection = function(c, result, visiting) {
  visiting.add(c);
  var isList = !!(c && c.is$List());
  result.add(isList ? "[" : "{");
  var first = true;
  for (var $$i = c.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    if (!first) {
      result.add(", ");
    }
    first = false;
    Collections._emitObject(e, result, visiting);
  }
  result.add(isList ? "]" : "}");
  visiting.removeLast();
}
Collections._emitObject = function(o, result, visiting) {
  if (!!(o && o.is$Collection())) {
    if (Collections._containsRef(visiting, o)) {
      result.add(!!(o && o.is$List()) ? "[...]" : "{...}");
    }
    else {
      Collections._emitCollection(o, result, visiting);
    }
  }
  else if (!!(o && o.is$Map())) {
    if (Collections._containsRef(visiting, o)) {
      result.add("{...}");
    }
    else {
      Maps._emitMap(o, result, visiting);
    }
  }
  else {
    result.add($eq$(o) ? "null" : o);
  }
}
Collections._containsRef = function(c, ref) {
  for (var $$i = c.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    if ((null == e ? null == (ref) : e === ref)) return true;
  }
  return false;
}
// ********** Code for HashMapImplementation **************
function HashMapImplementation() {
  this._numberOfEntries = (0);
  this._numberOfDeleted = (0);
  this._loadLimit = HashMapImplementation._computeLoadLimit((8));
  this._keys = new Array((8));
  this._values = new Array((8));
}
HashMapImplementation.prototype.is$Map = function(){return true};
HashMapImplementation.prototype.is$Map_dart_core_String$Dynamic = function(){return true};
HashMapImplementation._computeLoadLimit = function(capacity) {
  return $truncdiv$((capacity * (3)), (4));
}
HashMapImplementation._firstProbe = function(hashCode, length) {
  return hashCode & (length - (1));
}
HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length) {
  return (currentProbe + numberOfProbes) & (length - (1));
}
HashMapImplementation.prototype._probeForAdding = function(key) {
  var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length());
  var numberOfProbes = (1);
  var initialHash = hash;
  var insertionIndex = (-1);
  while (true) {
    var existingKey = this._keys.$index(hash);
    if (null == existingKey) {
      if (insertionIndex < (0)) return hash;
      return insertionIndex;
    }
    else if ($eq$(existingKey, key)) {
      return hash;
    }
    else if ((insertionIndex < (0)) && ((null == const$0000 ? null == (existingKey) : const$0000 === existingKey))) {
      insertionIndex = hash;
    }
    hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
  }
}
HashMapImplementation.prototype._probeForLookup = function(key) {
  var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$length());
  var numberOfProbes = (1);
  var initialHash = hash;
  while (true) {
    var existingKey = this._keys.$index(hash);
    if (null == existingKey) return (-1);
    if ($eq$(existingKey, key)) return hash;
    hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.get$length());
  }
}
HashMapImplementation.prototype._ensureCapacity = function() {
  var newNumberOfEntries = this._numberOfEntries + (1);
  if (newNumberOfEntries >= this._loadLimit) {
    this._grow(this._keys.get$length() * (2));
    return;
  }
  var capacity = this._keys.get$length();
  var numberOfFreeOrDeleted = capacity - newNumberOfEntries;
  var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted;
  if (this._numberOfDeleted > numberOfFree) {
    this._grow(this._keys.get$length());
  }
}
HashMapImplementation._isPowerOfTwo = function(x) {
  return ((x & (x - (1))) == (0));
}
HashMapImplementation.prototype._grow = function(newCapacity) {
  var capacity = this._keys.get$length();
  this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
  var oldKeys = this._keys;
  var oldValues = this._values;
  this._keys = new Array(newCapacity);
  this._values = new Array(newCapacity);
  for (var i = (0);
   i < capacity; i++) {
    var key = oldKeys.$index(i);
    if (null == key || (null == key ? null == (const$0000) : key === const$0000)) {
      continue;
    }
    var value = oldValues.$index(i);
    var newIndex = this._probeForAdding(key);
    this._keys.$setindex(newIndex, key);
    this._values.$setindex(newIndex, value);
  }
  this._numberOfDeleted = (0);
}
HashMapImplementation.prototype.clear = function() {
  this._numberOfEntries = (0);
  this._numberOfDeleted = (0);
  var length = this._keys.get$length();
  for (var i = (0);
   i < length; i++) {
    this._keys.$setindex(i);
    this._values.$setindex(i);
  }
}
HashMapImplementation.prototype.$setindex = function(key, value) {
  var $0;
  this._ensureCapacity();
  var index = this._probeForAdding(key);
  if ((null == this._keys.$index(index)) || ((($0 = this._keys.$index(index)) == null ? null == (const$0000) : $0 === const$0000))) {
    this._numberOfEntries++;
  }
  this._keys.$setindex(index, key);
  this._values.$setindex(index, value);
}
HashMapImplementation.prototype.$index = function(key) {
  var index = this._probeForLookup(key);
  if (index < (0)) return null;
  return this._values.$index(index);
}
HashMapImplementation.prototype.isEmpty = function() {
  return this._numberOfEntries == (0);
}
HashMapImplementation.prototype.forEach = function(f) {
  var length = this._keys.get$length();
  for (var i = (0);
   i < length; i++) {
    var key = this._keys.$index(i);
    if ((null != key) && ((null == key ? null != (const$0000) : key !== const$0000))) {
      f(key, this._values.$index(i));
    }
  }
}
HashMapImplementation.prototype.toString = function() {
  return Maps.mapToString(this);
}
HashMapImplementation.prototype.clear$0 = HashMapImplementation.prototype.clear;
// ********** Code for HashMapImplementation_dart_core_String$Object **************
/** Implements extends for Dart classes on JavaScript prototypes. */
function $inherits(child, parent) {
  if (child.prototype.__proto__) {
    child.prototype.__proto__ = parent.prototype;
  } else {
    function tmp() {};
    tmp.prototype = parent.prototype;
    child.prototype = new tmp();
    child.prototype.constructor = child;
  }
}
$inherits(HashMapImplementation_dart_core_String$Object, HashMapImplementation);
function HashMapImplementation_dart_core_String$Object() {
  this._numberOfEntries = (0);
  this._numberOfDeleted = (0);
  this._loadLimit = HashMapImplementation._computeLoadLimit((8));
  this._keys = new Array((8));
  this._values = new Array((8));
}
HashMapImplementation_dart_core_String$Object.prototype.is$Map = function(){return true};
HashMapImplementation_dart_core_String$Object.prototype.is$Map_dart_core_String$Dynamic = function(){return true};
// ********** Code for HashSetImplementation **************
function HashSetImplementation() {
  this._backingMap = new HashMapImplementation();
}
HashSetImplementation.prototype.is$Collection = function(){return true};
HashSetImplementation.prototype.clear = function() {
  this._backingMap.clear();
}
HashSetImplementation.prototype.add = function(value) {
  this._backingMap.$setindex(value, value);
}
HashSetImplementation.prototype.addAll = function(collection) {
  var $this = this; // closure support
  collection.forEach(function _(value) {
    $this.add(value);
  }
  );
}
HashSetImplementation.prototype.forEach = function(f) {
  this._backingMap.forEach(function _(key, value) {
    f(key);
  }
  );
}
HashSetImplementation.prototype.filter = function(f) {
  var result = new HashSetImplementation();
  this._backingMap.forEach(function _(key, value) {
    if (f(key)) result.add(key);
  }
  );
  return result;
}
HashSetImplementation.prototype.isEmpty = function() {
  return this._backingMap.isEmpty();
}
HashSetImplementation.prototype.iterator = function() {
  return new HashSetIterator(this);
}
HashSetImplementation.prototype.toString = function() {
  return Collections.collectionToString(this);
}
HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add;
HashSetImplementation.prototype.clear$0 = HashSetImplementation.prototype.clear;
// ********** Code for HashSetIterator **************
function HashSetIterator(set_) {
  this._nextValidIndex = (-1);
  this._entries = set_._backingMap._keys;
  this._advance();
}
HashSetIterator.prototype.hasNext = function() {
  var $0;
  if (this._nextValidIndex >= this._entries.get$length()) return false;
  if ((($0 = this._entries.$index(this._nextValidIndex)) == null ? null == (const$0000) : $0 === const$0000)) {
    this._advance();
  }
  return this._nextValidIndex < this._entries.get$length();
}
HashSetIterator.prototype.next = function() {
  if (!this.hasNext()) {
    $throw(const$0001);
  }
  var res = this._entries.$index(this._nextValidIndex);
  this._advance();
  return res;
}
HashSetIterator.prototype._advance = function() {
  var length = this._entries.get$length();
  var entry;
  var deletedKey = const$0000;
  do {
    if (++this._nextValidIndex >= length) break;
    entry = this._entries.$index(this._nextValidIndex);
  }
  while ((null == entry) || ((null == entry ? null == (deletedKey) : entry === deletedKey)))
}
// ********** Code for _DeletedKeySentinel **************
function _DeletedKeySentinel() {

}
// ********** Code for Maps **************
function Maps() {}
Maps.mapToString = function(m) {
  var result = new StringBufferImpl("");
  Maps._emitMap(m, result, new Array());
  return result.toString();
}
Maps._emitMap = function(m, result, visiting) {
  visiting.add(m);
  result.add("{");
  var first = true;
  m.forEach((function (k, v) {
    if (!first) {
      result.add(", ");
    }
    first = false;
    Collections._emitObject(k, result, visiting);
    result.add(": ");
    Collections._emitObject(v, result, visiting);
  })
  );
  result.add("}");
  visiting.removeLast();
}
// ********** Code for DoubleLinkedQueueEntry **************
function DoubleLinkedQueueEntry(e) {
  this._element = e;
}
DoubleLinkedQueueEntry.prototype._link = function(p, n) {
  this._next = n;
  this._previous = p;
  p._next = this;
  n._previous = this;
}
DoubleLinkedQueueEntry.prototype.prepend = function(e) {
  new DoubleLinkedQueueEntry(e)._link(this._previous, this);
}
DoubleLinkedQueueEntry.prototype.remove = function() {
  this._previous._next = this._next;
  this._next._previous = this._previous;
  this._next = null;
  this._previous = null;
  return this._element;
}
DoubleLinkedQueueEntry.prototype.get$element = function() {
  return this._element;
}
DoubleLinkedQueueEntry.prototype.remove$0 = DoubleLinkedQueueEntry.prototype.remove;
// ********** Code for _DoubleLinkedQueueEntrySentinel **************
$inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry);
function _DoubleLinkedQueueEntrySentinel() {
  DoubleLinkedQueueEntry.call(this, null);
  this._link(this, this);
}
_DoubleLinkedQueueEntrySentinel.prototype.remove = function() {
  $throw(const$0002);
}
_DoubleLinkedQueueEntrySentinel.prototype.get$element = function() {
  $throw(const$0002);
}
_DoubleLinkedQueueEntrySentinel.prototype.remove$0 = _DoubleLinkedQueueEntrySentinel.prototype.remove;
// ********** Code for DoubleLinkedQueue **************
function DoubleLinkedQueue() {
  this._sentinel = new _DoubleLinkedQueueEntrySentinel();
}
DoubleLinkedQueue.prototype.is$Collection = function(){return true};
DoubleLinkedQueue.prototype.addLast = function(value) {
  this._sentinel.prepend(value);
}
DoubleLinkedQueue.prototype.add = function(value) {
  this.addLast(value);
}
DoubleLinkedQueue.prototype.addAll = function(collection) {
  for (var $$i = collection.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    this.add(e);
  }
}
DoubleLinkedQueue.prototype.isEmpty = function() {
  var $0;
  return ((($0 = this._sentinel._next) == null ? null == (this._sentinel) : $0 === this._sentinel));
}
DoubleLinkedQueue.prototype.clear = function() {
  this._sentinel._next = this._sentinel;
  this._sentinel._previous = this._sentinel;
}
DoubleLinkedQueue.prototype.forEach = function(f) {
  var entry = this._sentinel._next;
  while ((null == entry ? null != (this._sentinel) : entry !== this._sentinel)) {
    var nextEntry = entry._next;
    f(entry._element);
    entry = nextEntry;
  }
}
DoubleLinkedQueue.prototype.filter = function(f) {
  var other = new DoubleLinkedQueue();
  var entry = this._sentinel._next;
  while ((null == entry ? null != (this._sentinel) : entry !== this._sentinel)) {
    var nextEntry = entry._next;
    if (f(entry._element)) other.addLast(entry._element);
    entry = nextEntry;
  }
  return other;
}
DoubleLinkedQueue.prototype.iterator = function() {
  return new _DoubleLinkedQueueIterator(this._sentinel);
}
DoubleLinkedQueue.prototype.toString = function() {
  return Collections.collectionToString(this);
}
DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add;
DoubleLinkedQueue.prototype.clear$0 = DoubleLinkedQueue.prototype.clear;
// ********** Code for _DoubleLinkedQueueIterator **************
function _DoubleLinkedQueueIterator(_sentinel) {
  this._sentinel = _sentinel;
  this._currentEntry = this._sentinel;
}
_DoubleLinkedQueueIterator.prototype.hasNext = function() {
  var $0;
  return (($0 = this._currentEntry._next) == null ? null != (this._sentinel) : $0 !== this._sentinel);
}
_DoubleLinkedQueueIterator.prototype.next = function() {
  if (!this.hasNext()) {
    $throw(const$0001);
  }
  this._currentEntry = this._currentEntry._next;
  return this._currentEntry.get$element();
}
// ********** Code for StringBufferImpl **************
function StringBufferImpl(content) {
  this.clear();
  this.add(content);
}
StringBufferImpl.prototype.add = function(obj) {
  var str = obj.toString();
  if (null == str || str.isEmpty()) return this;
  this._buffer.add(str);
  this._length = this._length + str.length;
  return this;
}
StringBufferImpl.prototype.addAll = function(objects) {
  for (var $$i = objects.iterator(); $$i.hasNext(); ) {
    var obj = $$i.next();
    this.add(obj);
  }
  return this;
}
StringBufferImpl.prototype.clear = function() {
  this._buffer = new Array();
  this._length = (0);
  return this;
}
StringBufferImpl.prototype.toString = function() {
  if (this._buffer.get$length() == (0)) return "";
  if (this._buffer.get$length() == (1)) return this._buffer.$index((0));
  var result = StringBase.concatAll(this._buffer);
  this._buffer.clear();
  this._buffer.add(result);
  return result;
}
StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add;
StringBufferImpl.prototype.clear$0 = StringBufferImpl.prototype.clear;
// ********** Code for StringBase **************
function StringBase() {}
StringBase.join = function(strings, separator) {
  if (strings.get$length() == (0)) return "";
  var s = strings.$index((0));
  for (var i = (1);
   i < strings.get$length(); i++) {
    s = $add$($add$(s, separator), strings.$index(i));
  }
  return s;
}
StringBase.concatAll = function(strings) {
  return StringBase.join(strings, "");
}
// ********** Code for StringImplementation **************
StringImplementation = String;
StringImplementation.prototype.isEmpty = function() {
  return this.length == (0);
}
StringImplementation.prototype.hashCode = function() {
      'use strict';
      var hash = 0;
      for (var i = 0; i < this.length; i++) {
        hash = 0x1fffffff & (hash + this.charCodeAt(i));
        hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
        hash ^= hash >> 6;
      }

      hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
      hash ^= hash >> 11;
      return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
}
// ********** Code for _ArgumentMismatchException **************
$inherits(_ArgumentMismatchException, ClosureArgumentMismatchException);
function _ArgumentMismatchException(_message) {
  this._dart_coreimpl_message = _message;
  ClosureArgumentMismatchException.call(this);
}
_ArgumentMismatchException.prototype.toString = function() {
  return ("Closure argument mismatch: " + this._dart_coreimpl_message);
}
// ********** Code for _FunctionImplementation **************
_FunctionImplementation = Function;
_FunctionImplementation.prototype._genStub = function(argsLength, names) {
      // Fast path #1: if no named arguments and arg count matches.
      var thisLength = this.$length || this.length;
      if (thisLength == argsLength && !names) {
        return this;
      }

      var paramsNamed = this.$optional ? (this.$optional.length / 2) : 0;
      var paramsBare = thisLength - paramsNamed;
      var argsNamed = names ? names.length : 0;
      var argsBare = argsLength - argsNamed;

      // Check we got the right number of arguments
      if (argsBare < paramsBare || argsLength > thisLength ||
          argsNamed > paramsNamed) {
        return function() {
          $throw(new _ArgumentMismatchException(
            'Wrong number of arguments to function. Expected ' + paramsBare +
            ' positional arguments and at most ' + paramsNamed +
            ' named arguments, but got ' + argsBare +
            ' positional arguments and ' + argsNamed + ' named arguments.'));
        };
      }

      // First, fill in all of the default values
      var p = new Array(paramsBare);
      if (paramsNamed) {
        p = p.concat(this.$optional.slice(paramsNamed));
      }
      // Fill in positional args
      var a = new Array(argsLength);
      for (var i = 0; i < argsBare; i++) {
        p[i] = a[i] = '$' + i;
      }
      // Then overwrite with supplied values for optional args
      var lastParameterIndex;
      var namesInOrder = true;
      for (var i = 0; i < argsNamed; i++) {
        var name = names[i];
        a[i + argsBare] = name;
        var j = this.$optional.indexOf(name);
        if (j < 0 || j >= paramsNamed) {
          return function() {
            $throw(new _ArgumentMismatchException(
              'Named argument "' + name + '" was not expected by function.' +
              ' Did you forget to mark the function parameter [optional]?'));
          };
        } else if (lastParameterIndex && lastParameterIndex > j) {
          namesInOrder = false;
        }
        p[j + paramsBare] = name;
        lastParameterIndex = j;
      }

      if (thisLength == argsLength && namesInOrder) {
        // Fast path #2: named arguments, but they're in order and all supplied.
        return this;
      }

      // Note: using Function instead of 'eval' to get a clean scope.
      // TODO(jmesserly): evaluate the performance of these stubs.
      var f = 'function(' + a.join(',') + '){return $f(' + p.join(',') + ');}';
      return new Function('$f', 'return ' + f + '').call(null, this);
    
}
// ********** Code for top level **************
//  ********** Library html **************
// ********** Code for _EventTargetImpl **************
$defProp(Object.prototype, '$typeNameOf', (function() {
  function constructorNameWithFallback(obj) {
    var constructor = obj.constructor;
    if (typeof(constructor) == 'function') {
      // The constructor isn't null or undefined at this point. Try
      // to grab hold of its name.
      var name = constructor.name;
      // If the name is a non-empty string, we use that as the type
      // name of this object. On Firefox, we often get 'Object' as
      // the constructor name even for more specialized objects so
      // we have to fall through to the toString() based implementation
      // below in that case.
      if (typeof(name) == 'string' && name && name != 'Object') return name;
    }
    var string = Object.prototype.toString.call(obj);
    return string.substring(8, string.length - 1);
  }

  function chrome$typeNameOf() {
    var name = this.constructor.name;
    if (name == 'Window') return 'DOMWindow';
    return name;
  }

  function firefox$typeNameOf() {
    var name = constructorNameWithFallback(this);
    if (name == 'Window') return 'DOMWindow';
    if (name == 'Document') return 'HTMLDocument';
    if (name == 'XMLDocument') return 'Document';
    return name;
  }

  function ie$typeNameOf() {
    var name = constructorNameWithFallback(this);
    if (name == 'Window') return 'DOMWindow';
    // IE calls both HTML and XML documents 'Document', so we check for the
    // xmlVersion property, which is the empty string on HTML documents.
    if (name == 'Document' && this.xmlVersion) return 'Document';
    if (name == 'Document') return 'HTMLDocument';
    return name;
  }

  // If we're not in the browser, we're almost certainly running on v8.
  if (typeof(navigator) != 'object') return chrome$typeNameOf;

  var userAgent = navigator.userAgent;
  if (/Chrome|DumpRenderTree/.test(userAgent)) return chrome$typeNameOf;
  if (/Firefox/.test(userAgent)) return firefox$typeNameOf;
  if (/MSIE/.test(userAgent)) return ie$typeNameOf;
  return function() { return constructorNameWithFallback(this); };
})());
function $dynamic(name) {
  var f = Object.prototype[name];
  if (f && f.methods) return f.methods;

  var methods = {};
  if (f) methods.Object = f;
  function $dynamicBind() {
    // Find the target method
    var obj = this;
    var tag = obj.$typeNameOf();
    var method = methods[tag];
    if (!method) {
      var table = $dynamicMetadata;
      for (var i = 0; i < table.length; i++) {
        var entry = table[i];
        if (entry.map.hasOwnProperty(tag)) {
          method = methods[entry.tag];
          if (method) break;
        }
      }
    }
    method = method || methods.Object;
    var proto = Object.getPrototypeOf(obj);
    if (!proto.hasOwnProperty(name)) {
      $defProp(proto, name, method);
    }

    return method.apply(this, Array.prototype.slice.call(arguments));
  };
  $dynamicBind.methods = methods;
  $defProp(Object.prototype, name, $dynamicBind);
  return methods;
}
if (typeof $dynamicMetadata == 'undefined') $dynamicMetadata = [];
$dynamic("_addEventListener").EventTarget = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _NodeImpl **************
$dynamic("get$nodes").Node = function() {
  var list = this.get$_childNodes();
  list.set$_parent(this);
  return list;
}
$dynamic("remove").Node = function() {
  if ($ne$(this.get$parent())) {
    var parent = this.get$parent();
    parent._removeChild(this);
  }
  return this;
}
$dynamic("replaceWith").Node = function(otherNode) {
  try {
    var parent = this.get$parent();
    parent._replaceChild(otherNode, this);
  } catch (e) {
    e = _toDartException(e);
  }
  ;
  return this;
}
$dynamic("get$_childNodes").Node = function() {
  return this.childNodes;
}
$dynamic("get$parent").Node = function() {
  return this.parentNode;
}
$dynamic("get$text").Node = function() {
  return this.textContent;
}
$dynamic("set$text").Node = function(value) {
  this.textContent = value;
}
$dynamic("_appendChild").Node = function(newChild) {
  return this.appendChild(newChild);
}
$dynamic("_removeChild").Node = function(oldChild) {
  return this.removeChild(oldChild);
}
$dynamic("_replaceChild").Node = function(newChild, oldChild) {
  return this.replaceChild(newChild, oldChild);
}
$dynamic("remove$0").Node = function() {
  return this.remove();
};
// ********** Code for _ElementImpl **************
$dynamic("is$html_Element").Element = function(){return true};
$dynamic("get$elements").Element = function() {
  return new _ChildrenElementList._wrap$ctor(this);
}
$dynamic("get$on").Element = function() {
  return new _ElementEventsImpl(this);
}
$dynamic("get$_children").Element = function() {
  return this.children;
}
$dynamic("get$_firstElementChild").Element = function() {
  return this.firstElementChild;
}
$dynamic("set$hidden").Element = function(value) { return this.hidden = value; };
$dynamic("set$innerHTML").Element = function(value) { return this.innerHTML = value; };
$dynamic("get$style").Element = function() { return this.style; };
$dynamic("get$click").Element = function() {
  return this.click.bind(this);
}
Function.prototype.bind = Function.prototype.bind ||
  function(thisObj) {
    var func = this;
    var funcLength = func.$length || func.length;
    var argsLength = arguments.length;
    if (argsLength > 1) {
      var boundArgs = Array.prototype.slice.call(arguments, 1);
      var bound = function() {
        // Prepend the bound arguments to the current arguments.
        var newArgs = Array.prototype.slice.call(arguments);
        Array.prototype.unshift.apply(newArgs, boundArgs);
        return func.apply(thisObj, newArgs);
      };
      bound.$length = Math.max(0, funcLength - (argsLength - 1));
      return bound;
    } else {
      var bound = function() {
        return func.apply(thisObj, arguments);
      };
      bound.$length = funcLength;
      return bound;
    }
  };
$dynamic("query").Element = function(selectors) {
  return this.querySelector(selectors);
}
// ********** Code for _HTMLElementImpl **************
// ********** Code for _AbstractWorkerImpl **************
$dynamic("_addEventListener").AbstractWorker = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _AnchorElementImpl **************
$dynamic("is$html_Element").HTMLAnchorElement = function(){return true};
// ********** Code for _AnimationImpl **************
// ********** Code for _EventImpl **************
// ********** Code for _AnimationEventImpl **************
// ********** Code for _AnimationListImpl **************
// ********** Code for _AppletElementImpl **************
$dynamic("is$html_Element").HTMLAppletElement = function(){return true};
// ********** Code for _AreaElementImpl **************
$dynamic("is$html_Element").HTMLAreaElement = function(){return true};
// ********** Code for _ArrayBufferImpl **************
// ********** Code for _ArrayBufferViewImpl **************
// ********** Code for _AttrImpl **************
// ********** Code for _AudioBufferImpl **************
// ********** Code for _AudioNodeImpl **************
// ********** Code for _AudioSourceNodeImpl **************
// ********** Code for _AudioBufferSourceNodeImpl **************
// ********** Code for _AudioChannelMergerImpl **************
// ********** Code for _AudioChannelSplitterImpl **************
// ********** Code for _AudioContextImpl **************
// ********** Code for _AudioDestinationNodeImpl **************
// ********** Code for _MediaElementImpl **************
$dynamic("is$html_Element").HTMLMediaElement = function(){return true};
// ********** Code for _AudioElementImpl **************
$dynamic("is$html_Element").HTMLAudioElement = function(){return true};
// ********** Code for _AudioParamImpl **************
// ********** Code for _AudioGainImpl **************
// ********** Code for _AudioGainNodeImpl **************
// ********** Code for _AudioListenerImpl **************
// ********** Code for _AudioPannerNodeImpl **************
// ********** Code for _AudioProcessingEventImpl **************
// ********** Code for _BRElementImpl **************
$dynamic("is$html_Element").HTMLBRElement = function(){return true};
// ********** Code for _BarInfoImpl **************
// ********** Code for _BaseElementImpl **************
$dynamic("is$html_Element").HTMLBaseElement = function(){return true};
// ********** Code for _BaseFontElementImpl **************
$dynamic("is$html_Element").HTMLBaseFontElement = function(){return true};
// ********** Code for _BeforeLoadEventImpl **************
// ********** Code for _BiquadFilterNodeImpl **************
// ********** Code for _BlobImpl **************
// ********** Code for _BlobBuilderImpl **************
// ********** Code for _BodyElementImpl **************
$dynamic("is$html_Element").HTMLBodyElement = function(){return true};
$dynamic("get$on").HTMLBodyElement = function() {
  return new _BodyElementEventsImpl(this);
}
// ********** Code for _EventsImpl **************
function _EventsImpl(_ptr) {
  this._ptr = _ptr;
}
_EventsImpl.prototype._get = function(type) {
  return new _EventListenerListImpl(this._ptr, type);
}
// ********** Code for _ElementEventsImpl **************
$inherits(_ElementEventsImpl, _EventsImpl);
function _ElementEventsImpl(_ptr) {
  _EventsImpl.call(this, _ptr);
}
_ElementEventsImpl.prototype.get$change = function() {
  return this._get("change");
}
_ElementEventsImpl.prototype.get$click = function() {
  return this._get("click");
}
_ElementEventsImpl.prototype.get$doubleClick = function() {
  return this._get("dblclick");
}
_ElementEventsImpl.prototype.get$input = function() {
  return this._get("input");
}
_ElementEventsImpl.prototype.get$mouseDown = function() {
  return this._get("mousedown");
}
_ElementEventsImpl.prototype.get$mouseMove = function() {
  return this._get("mousemove");
}
_ElementEventsImpl.prototype.get$mouseUp = function() {
  return this._get("mouseup");
}
// ********** Code for _BodyElementEventsImpl **************
$inherits(_BodyElementEventsImpl, _ElementEventsImpl);
function _BodyElementEventsImpl(_ptr) {
  _ElementEventsImpl.call(this, _ptr);
}
// ********** Code for _ButtonElementImpl **************
$dynamic("is$html_Element").HTMLButtonElement = function(){return true};
// ********** Code for _CharacterDataImpl **************
// ********** Code for _TextImpl **************
// ********** Code for _CDATASectionImpl **************
// ********** Code for _CSSRuleImpl **************
// ********** Code for _CSSCharsetRuleImpl **************
// ********** Code for _CSSFontFaceRuleImpl **************
// ********** Code for _CSSImportRuleImpl **************
// ********** Code for _CSSKeyframeRuleImpl **************
// ********** Code for _CSSKeyframesRuleImpl **************
// ********** Code for _CSSMatrixImpl **************
// ********** Code for _CSSMediaRuleImpl **************
// ********** Code for _CSSPageRuleImpl **************
// ********** Code for _CSSValueImpl **************
// ********** Code for _CSSPrimitiveValueImpl **************
// ********** Code for _CSSRuleListImpl **************
// ********** Code for _CSSStyleDeclarationImpl **************
$dynamic("set$borderColor").CSSStyleDeclaration = function(value) {
  this.setProperty("border-color", value, "");
}
// ********** Code for _CSSStyleRuleImpl **************
// ********** Code for _StyleSheetImpl **************
// ********** Code for _CSSStyleSheetImpl **************
// ********** Code for _CSSValueListImpl **************
// ********** Code for _CSSTransformValueImpl **************
// ********** Code for _CSSUnknownRuleImpl **************
// ********** Code for _CanvasElementImpl **************
$dynamic("is$html_Element").HTMLCanvasElement = function(){return true};
// ********** Code for _CanvasGradientImpl **************
// ********** Code for _CanvasPatternImpl **************
// ********** Code for _CanvasPixelArrayImpl **************
$dynamic("is$List").CanvasPixelArray = function(){return true};
$dynamic("is$Collection").CanvasPixelArray = function(){return true};
$dynamic("get$length").CanvasPixelArray = function() { return this.length; };
$dynamic("$index").CanvasPixelArray = function(index) {
  return this[index];
}
$dynamic("$setindex").CanvasPixelArray = function(index, value) {
  this[index] = value
}
$dynamic("iterator").CanvasPixelArray = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").CanvasPixelArray = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").CanvasPixelArray = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").CanvasPixelArray = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").CanvasPixelArray = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").CanvasPixelArray = function() {
  return this.length == (0);
}
$dynamic("sort").CanvasPixelArray = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").CanvasPixelArray = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").CanvasPixelArray = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").CanvasPixelArray = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").CanvasPixelArray = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").CanvasPixelArray = function($0) {
  return this.add($0);
};
// ********** Code for _CanvasRenderingContextImpl **************
// ********** Code for _CanvasRenderingContext2DImpl **************
// ********** Code for _ClientRectImpl **************
// ********** Code for _ClientRectListImpl **************
// ********** Code for _ClipboardImpl **************
// ********** Code for _CloseEventImpl **************
// ********** Code for _CommentImpl **************
// ********** Code for _UIEventImpl **************
// ********** Code for _CompositionEventImpl **************
// ********** Code for _ConsoleImpl **************
_ConsoleImpl = (typeof console == 'undefined' ? {} : console);
// ********** Code for _ContentElementImpl **************
$dynamic("is$html_Element").HTMLContentElement = function(){return true};
// ********** Code for _ConvolverNodeImpl **************
// ********** Code for _CoordinatesImpl **************
// ********** Code for _CounterImpl **************
// ********** Code for _CryptoImpl **************
// ********** Code for _CustomEventImpl **************
// ********** Code for _DListElementImpl **************
$dynamic("is$html_Element").HTMLDListElement = function(){return true};
// ********** Code for _DOMApplicationCacheImpl **************
$dynamic("_addEventListener").DOMApplicationCache = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _DOMExceptionImpl **************
// ********** Code for _DOMFileSystemImpl **************
// ********** Code for _DOMFileSystemSyncImpl **************
// ********** Code for _DOMFormDataImpl **************
// ********** Code for _DOMImplementationImpl **************
// ********** Code for _DOMMimeTypeImpl **************
// ********** Code for _DOMMimeTypeArrayImpl **************
// ********** Code for _DOMParserImpl **************
// ********** Code for _DOMPluginImpl **************
// ********** Code for _DOMPluginArrayImpl **************
// ********** Code for _DOMSelectionImpl **************
// ********** Code for _DOMTokenListImpl **************
$dynamic("add$1").DOMTokenList = function($0) {
  return this.add($0);
};
// ********** Code for _DOMSettableTokenListImpl **************
// ********** Code for _DOMURLImpl **************
// ********** Code for _DataTransferItemImpl **************
// ********** Code for _DataTransferItemListImpl **************
$dynamic("add$1").DataTransferItemList = function($0) {
  return this.add($0);
};
$dynamic("clear$0").DataTransferItemList = function() {
  return this.clear();
};
// ********** Code for _DataViewImpl **************
// ********** Code for _DatabaseImpl **************
// ********** Code for _DatabaseSyncImpl **************
// ********** Code for _WorkerContextImpl **************
// ********** Code for _DedicatedWorkerContextImpl **************
// ********** Code for _DelayNodeImpl **************
// ********** Code for _DeprecatedPeerConnectionImpl **************
// ********** Code for _DetailsElementImpl **************
$dynamic("is$html_Element").HTMLDetailsElement = function(){return true};
// ********** Code for _DeviceMotionEventImpl **************
// ********** Code for _DeviceOrientationEventImpl **************
// ********** Code for _DirectoryElementImpl **************
$dynamic("is$html_Element").HTMLDirectoryElement = function(){return true};
// ********** Code for _EntryImpl **************
// ********** Code for _DirectoryEntryImpl **************
// ********** Code for _EntrySyncImpl **************
$dynamic("remove$0").EntrySync = function() {
  return this.remove();
};
// ********** Code for _DirectoryEntrySyncImpl **************
// ********** Code for _DirectoryReaderImpl **************
// ********** Code for _DirectoryReaderSyncImpl **************
// ********** Code for _DivElementImpl **************
$dynamic("is$html_Element").HTMLDivElement = function(){return true};
// ********** Code for _DocumentImpl **************
$dynamic("is$html_Element").HTMLHtmlElement = function(){return true};
$dynamic("get$on").HTMLHtmlElement = function() {
  return new _DocumentEventsImpl(this.get$_jsDocument());
}
$dynamic("get$window").HTMLHtmlElement = function() {
  return this.parentNode.defaultView;
}
$dynamic("_createElement").HTMLHtmlElement = function(tagName) {
  return this.parentNode.createElement(tagName);
}
$dynamic("get$_jsDocument").HTMLHtmlElement = function() {
  return this.parentNode;
}
$dynamic("get$parent").HTMLHtmlElement = function() {
  return null;
}
// ********** Code for _SecretHtmlDocumentImpl **************
// ********** Code for _DocumentEventsImpl **************
$inherits(_DocumentEventsImpl, _ElementEventsImpl);
function _DocumentEventsImpl(_ptr) {
  _ElementEventsImpl.call(this, _ptr);
}
_DocumentEventsImpl.prototype.get$change = function() {
  return this._get("change");
}
_DocumentEventsImpl.prototype.get$click = function() {
  return this._get("click");
}
_DocumentEventsImpl.prototype.get$doubleClick = function() {
  return this._get("dblclick");
}
_DocumentEventsImpl.prototype.get$input = function() {
  return this._get("input");
}
_DocumentEventsImpl.prototype.get$mouseDown = function() {
  return this._get("mousedown");
}
_DocumentEventsImpl.prototype.get$mouseMove = function() {
  return this._get("mousemove");
}
_DocumentEventsImpl.prototype.get$mouseUp = function() {
  return this._get("mouseup");
}
// ********** Code for FilteredElementList **************
function FilteredElementList(node) {
  this._childNodes = node.get$nodes();
  this._node = node;
}
FilteredElementList.prototype.is$List = function(){return true};
FilteredElementList.prototype.is$Collection = function(){return true};
FilteredElementList.prototype.get$_filtered = function() {
  return ListFactory.ListFactory$from$factory(this._childNodes.filter((function (n) {
    return !!(n && n.is$html_Element());
  })
  ));
}
FilteredElementList.prototype.get$first = function() {
  var $$list = this._childNodes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var node = $$i.next();
    if (!!(node && node.is$html_Element())) {
      return node;
    }
  }
  return null;
}
FilteredElementList.prototype.forEach = function(f) {
  this.get$_filtered().forEach(f);
}
FilteredElementList.prototype.$setindex = function(index, value) {
  this.$index(index).replaceWith(value);
}
FilteredElementList.prototype.add = function(value) {
  this._childNodes.add(value);
}
FilteredElementList.prototype.get$add = function() {
  return this.add.bind(this);
}
FilteredElementList.prototype.addAll = function(collection) {
  collection.forEach(this.get$add());
}
FilteredElementList.prototype.sort = function(compare) {
  $throw(const$0004);
}
FilteredElementList.prototype.removeRange = function(start, length) {
  this.get$_filtered().getRange(start, length).forEach((function (el) {
    return el.remove$0();
  })
  );
}
FilteredElementList.prototype.clear = function() {
  this._childNodes.clear();
}
FilteredElementList.prototype.removeLast = function() {
  var last = this.last();
  if ($ne$(last)) {
    last.remove$0();
  }
  return last;
}
FilteredElementList.prototype.filter = function(f) {
  return this.get$_filtered().filter(f);
}
FilteredElementList.prototype.isEmpty = function() {
  return this.get$_filtered().isEmpty();
}
FilteredElementList.prototype.get$length = function() {
  return this.get$_filtered().get$length();
}
FilteredElementList.prototype.$index = function(index) {
  return this.get$_filtered().$index(index);
}
FilteredElementList.prototype.iterator = function() {
  return this.get$_filtered().iterator();
}
FilteredElementList.prototype.getRange = function(start, length) {
  return this.get$_filtered().getRange(start, length);
}
FilteredElementList.prototype.indexOf = function(element, start) {
  return this.get$_filtered().indexOf(element, start);
}
FilteredElementList.prototype.last = function() {
  return this.get$_filtered().last();
}
FilteredElementList.prototype.add$1 = FilteredElementList.prototype.add;
FilteredElementList.prototype.clear$0 = FilteredElementList.prototype.clear;
// ********** Code for _DocumentFragmentImpl **************
$dynamic("is$html_Element").DocumentFragment = function(){return true};
$dynamic("get$elements").DocumentFragment = function() {
  if (this._elements == null) {
    this._elements = new FilteredElementList(this);
  }
  return this._elements;
}
$dynamic("set$innerHTML").DocumentFragment = function(value) {
  this.get$nodes().clear();
  var e = _ElementFactoryProvider.Element$tag$factory("div");
  e.set$innerHTML(value);
  var nodes = ListFactory.ListFactory$from$factory(e.get$nodes());
  this.get$nodes().addAll(nodes);
}
$dynamic("set$hidden").DocumentFragment = function(value) {
  $throw(new UnsupportedOperationException("Hidden can't be set for document fragments."));
}
$dynamic("get$parent").DocumentFragment = function() {
  return null;
}
$dynamic("get$style").DocumentFragment = function() {
  return _ElementFactoryProvider.Element$tag$factory("div").get$style();
}
$dynamic("click").DocumentFragment = function() {

}
$dynamic("get$click").DocumentFragment = function() {
  return this.click.bind(this);
}
$dynamic("get$on").DocumentFragment = function() {
  return new _ElementEventsImpl(this);
}
$dynamic("query").DocumentFragment = function(selectors) {
  return this.querySelector(selectors);
}
// ********** Code for _DocumentTypeImpl **************
// ********** Code for _DynamicsCompressorNodeImpl **************
// ********** Code for _EXTTextureFilterAnisotropicImpl **************
// ********** Code for _ChildrenElementList **************
_ChildrenElementList._wrap$ctor = function(element) {
  this._childElements = element.get$_children();
  this._html_element = element;
}
_ChildrenElementList._wrap$ctor.prototype = _ChildrenElementList.prototype;
function _ChildrenElementList() {}
_ChildrenElementList.prototype.is$List = function(){return true};
_ChildrenElementList.prototype.is$Collection = function(){return true};
_ChildrenElementList.prototype._toList = function() {
  var output = new Array(this._childElements.get$length());
  for (var i = (0), len = this._childElements.get$length();
   i < len; i++) {
    output.$setindex(i, this._childElements.$index(i));
  }
  return output;
}
_ChildrenElementList.prototype.get$first = function() {
  return this._html_element.get$_firstElementChild();
}
_ChildrenElementList.prototype.forEach = function(f) {
  var $$list = this._childElements;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var element = $$i.next();
    f(element);
  }
}
_ChildrenElementList.prototype.filter = function(f) {
  var output = [];
  this.forEach((function (element) {
    if (f(element)) {
      output.add$1(element);
    }
  })
  );
  return new _FrozenElementList._wrap$ctor(output);
}
_ChildrenElementList.prototype.isEmpty = function() {
  return this._html_element.get$_firstElementChild() == null;
}
_ChildrenElementList.prototype.get$length = function() {
  return this._childElements.get$length();
}
_ChildrenElementList.prototype.$index = function(index) {
  return this._childElements.$index(index);
}
_ChildrenElementList.prototype.$setindex = function(index, value) {
  this._html_element._replaceChild(value, this._childElements.$index(index));
}
_ChildrenElementList.prototype.add = function(value) {
  this._html_element._appendChild(value);
  return value;
}
_ChildrenElementList.prototype.iterator = function() {
  return this._toList().iterator();
}
_ChildrenElementList.prototype.addAll = function(collection) {
  for (var $$i = collection.iterator(); $$i.hasNext(); ) {
    var element = $$i.next();
    this._html_element._appendChild(element);
  }
}
_ChildrenElementList.prototype.sort = function(compare) {
  $throw(const$0004);
}
_ChildrenElementList.prototype.removeRange = function(start, length) {
  $throw(const$0005);
}
_ChildrenElementList.prototype.getRange = function(start, length) {
  return new _FrozenElementList._wrap$ctor(_Lists.getRange(this, start, length, []));
}
_ChildrenElementList.prototype.indexOf = function(element, start) {
  return _Lists.indexOf(this, element, start, this.get$length());
}
_ChildrenElementList.prototype.clear = function() {
  this._html_element.set$text("");
}
_ChildrenElementList.prototype.removeLast = function() {
  var last = this.last();
  if ($ne$(last)) {
    this._html_element._removeChild(last);
  }
  return last;
}
_ChildrenElementList.prototype.last = function() {
  return this._html_element.lastElementChild;
}
_ChildrenElementList.prototype.add$1 = _ChildrenElementList.prototype.add;
_ChildrenElementList.prototype.clear$0 = _ChildrenElementList.prototype.clear;
// ********** Code for _FrozenElementList **************
_FrozenElementList._wrap$ctor = function(_nodeList) {
  this._nodeList = _nodeList;
}
_FrozenElementList._wrap$ctor.prototype = _FrozenElementList.prototype;
function _FrozenElementList() {}
_FrozenElementList.prototype.is$List = function(){return true};
_FrozenElementList.prototype.is$Collection = function(){return true};
_FrozenElementList.prototype.get$first = function() {
  return this._nodeList.$index((0));
}
_FrozenElementList.prototype.forEach = function(f) {
  for (var $$i = this.iterator(); $$i.hasNext(); ) {
    var el = $$i.next();
    f(el);
  }
}
_FrozenElementList.prototype.filter = function(f) {
  var out = new _ElementList([]);
  for (var $$i = this.iterator(); $$i.hasNext(); ) {
    var el = $$i.next();
    if (f(el)) out.add$1(el);
  }
  return out;
}
_FrozenElementList.prototype.isEmpty = function() {
  return this._nodeList.isEmpty();
}
_FrozenElementList.prototype.get$length = function() {
  return this._nodeList.get$length();
}
_FrozenElementList.prototype.$index = function(index) {
  return this._nodeList.$index(index);
}
_FrozenElementList.prototype.$setindex = function(index, value) {
  $throw(const$0003);
}
_FrozenElementList.prototype.add = function(value) {
  $throw(const$0003);
}
_FrozenElementList.prototype.iterator = function() {
  return new _FrozenElementListIterator(this);
}
_FrozenElementList.prototype.addAll = function(collection) {
  $throw(const$0003);
}
_FrozenElementList.prototype.sort = function(compare) {
  $throw(const$0003);
}
_FrozenElementList.prototype.removeRange = function(start, length) {
  $throw(const$0003);
}
_FrozenElementList.prototype.getRange = function(start, length) {
  return new _FrozenElementList._wrap$ctor(this._nodeList.getRange(start, length));
}
_FrozenElementList.prototype.indexOf = function(element, start) {
  return this._nodeList.indexOf(element, start);
}
_FrozenElementList.prototype.clear = function() {
  $throw(const$0003);
}
_FrozenElementList.prototype.removeLast = function() {
  $throw(const$0003);
}
_FrozenElementList.prototype.last = function() {
  return this._nodeList.last();
}
_FrozenElementList.prototype.add$1 = _FrozenElementList.prototype.add;
_FrozenElementList.prototype.clear$0 = _FrozenElementList.prototype.clear;
// ********** Code for _FrozenElementListIterator **************
function _FrozenElementListIterator(_list) {
  this._html_index = (0);
  this._html_list = _list;
}
_FrozenElementListIterator.prototype.next = function() {
  if (!this.hasNext()) {
    $throw(const$0001);
  }
  return this._html_list.$index(this._html_index++);
}
_FrozenElementListIterator.prototype.hasNext = function() {
  return this._html_index < this._html_list.get$length();
}
// ********** Code for _ListWrapper **************
function _ListWrapper() {}
_ListWrapper.prototype.is$List = function(){return true};
_ListWrapper.prototype.is$Collection = function(){return true};
_ListWrapper.prototype.iterator = function() {
  return this._html_list.iterator();
}
_ListWrapper.prototype.forEach = function(f) {
  return this._html_list.forEach(f);
}
_ListWrapper.prototype.filter = function(f) {
  return this._html_list.filter(f);
}
_ListWrapper.prototype.isEmpty = function() {
  return this._html_list.isEmpty();
}
_ListWrapper.prototype.get$length = function() {
  return this._html_list.get$length();
}
_ListWrapper.prototype.$index = function(index) {
  return this._html_list.$index(index);
}
_ListWrapper.prototype.$setindex = function(index, value) {
  this._html_list.$setindex(index, value);
}
_ListWrapper.prototype.add = function(value) {
  return this._html_list.add(value);
}
_ListWrapper.prototype.addAll = function(collection) {
  return this._html_list.addAll(collection);
}
_ListWrapper.prototype.sort = function(compare) {
  return this._html_list.sort(compare);
}
_ListWrapper.prototype.indexOf = function(element, start) {
  return this._html_list.indexOf(element, start);
}
_ListWrapper.prototype.clear = function() {
  return this._html_list.clear();
}
_ListWrapper.prototype.removeLast = function() {
  return this._html_list.removeLast();
}
_ListWrapper.prototype.last = function() {
  return this._html_list.last();
}
_ListWrapper.prototype.getRange = function(start, length) {
  return this._html_list.getRange(start, length);
}
_ListWrapper.prototype.removeRange = function(start, length) {
  return this._html_list.removeRange(start, length);
}
_ListWrapper.prototype.get$first = function() {
  return this._html_list.$index((0));
}
_ListWrapper.prototype.add$1 = _ListWrapper.prototype.add;
_ListWrapper.prototype.clear$0 = _ListWrapper.prototype.clear;
// ********** Code for _ListWrapper_Element **************
$inherits(_ListWrapper_Element, _ListWrapper);
function _ListWrapper_Element(_list) {
  this._html_list = _list;
}
_ListWrapper_Element.prototype.is$List = function(){return true};
_ListWrapper_Element.prototype.is$Collection = function(){return true};
_ListWrapper_Element.prototype.add$1 = _ListWrapper_Element.prototype.add;
_ListWrapper_Element.prototype.clear$0 = _ListWrapper_Element.prototype.clear;
// ********** Code for _ElementList **************
$inherits(_ElementList, _ListWrapper_Element);
function _ElementList(list) {
  _ListWrapper_Element.call(this, list);
}
_ElementList.prototype.is$List = function(){return true};
_ElementList.prototype.is$Collection = function(){return true};
_ElementList.prototype.filter = function(f) {
  return new _ElementList(_ListWrapper_Element.prototype.filter.call(this, f));
}
_ElementList.prototype.getRange = function(start, length) {
  return new _ElementList(_ListWrapper_Element.prototype.getRange.call(this, start, length));
}
// ********** Code for _ElementTimeControlImpl **************
// ********** Code for _ElementTraversalImpl **************
// ********** Code for _EmbedElementImpl **************
$dynamic("is$html_Element").HTMLEmbedElement = function(){return true};
// ********** Code for _EntityImpl **************
// ********** Code for _EntityReferenceImpl **************
// ********** Code for _EntryArrayImpl **************
// ********** Code for _EntryArraySyncImpl **************
// ********** Code for _ErrorEventImpl **************
// ********** Code for _EventExceptionImpl **************
// ********** Code for _EventSourceImpl **************
$dynamic("_addEventListener").EventSource = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _EventListenerListImpl **************
function _EventListenerListImpl(_ptr, _type) {
  this._ptr = _ptr;
  this._type = _type;
}
_EventListenerListImpl.prototype.add = function(listener, useCapture) {
  this._add(listener, useCapture);
  return this;
}
_EventListenerListImpl.prototype._add = function(listener, useCapture) {
  this._ptr._addEventListener(this._type, listener, useCapture);
}
_EventListenerListImpl.prototype.add$1 = function($0) {
  return this.add(to$call$1($0), false);
};
// ********** Code for _FieldSetElementImpl **************
$dynamic("is$html_Element").HTMLFieldSetElement = function(){return true};
// ********** Code for _FileImpl **************
// ********** Code for _FileEntryImpl **************
// ********** Code for _FileEntrySyncImpl **************
// ********** Code for _FileErrorImpl **************
// ********** Code for _FileExceptionImpl **************
// ********** Code for _FileListImpl **************
// ********** Code for _FileReaderImpl **************
// ********** Code for _FileReaderSyncImpl **************
// ********** Code for _FileWriterImpl **************
// ********** Code for _FileWriterSyncImpl **************
// ********** Code for _Float32ArrayImpl **************
var _Float32ArrayImpl = {};
$dynamic("is$List").Float32Array = function(){return true};
$dynamic("is$Collection").Float32Array = function(){return true};
$dynamic("get$length").Float32Array = function() { return this.length; };
$dynamic("$index").Float32Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Float32Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Float32Array = function() {
  return new _FixedSizeListIterator_num(this);
}
$dynamic("add").Float32Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Float32Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Float32Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Float32Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Float32Array = function() {
  return this.length == (0);
}
$dynamic("sort").Float32Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Float32Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Float32Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Float32Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Float32Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Float32Array = function($0) {
  return this.add($0);
};
// ********** Code for _Float64ArrayImpl **************
var _Float64ArrayImpl = {};
$dynamic("is$List").Float64Array = function(){return true};
$dynamic("is$Collection").Float64Array = function(){return true};
$dynamic("get$length").Float64Array = function() { return this.length; };
$dynamic("$index").Float64Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Float64Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Float64Array = function() {
  return new _FixedSizeListIterator_num(this);
}
$dynamic("add").Float64Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Float64Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Float64Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Float64Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Float64Array = function() {
  return this.length == (0);
}
$dynamic("sort").Float64Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Float64Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Float64Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Float64Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Float64Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Float64Array = function($0) {
  return this.add($0);
};
// ********** Code for _FontElementImpl **************
$dynamic("is$html_Element").HTMLFontElement = function(){return true};
// ********** Code for _FormElementImpl **************
$dynamic("is$html_Element").HTMLFormElement = function(){return true};
// ********** Code for _FrameElementImpl **************
$dynamic("is$html_Element").HTMLFrameElement = function(){return true};
// ********** Code for _FrameSetElementImpl **************
$dynamic("is$html_Element").HTMLFrameSetElement = function(){return true};
$dynamic("get$on").HTMLFrameSetElement = function() {
  return new _FrameSetElementEventsImpl(this);
}
// ********** Code for _FrameSetElementEventsImpl **************
$inherits(_FrameSetElementEventsImpl, _ElementEventsImpl);
function _FrameSetElementEventsImpl(_ptr) {
  _ElementEventsImpl.call(this, _ptr);
}
// ********** Code for _GeolocationImpl **************
// ********** Code for _GeopositionImpl **************
// ********** Code for _HRElementImpl **************
$dynamic("is$html_Element").HTMLHRElement = function(){return true};
// ********** Code for _HTMLAllCollectionImpl **************
// ********** Code for _HTMLCollectionImpl **************
$dynamic("is$List").HTMLCollection = function(){return true};
$dynamic("is$Collection").HTMLCollection = function(){return true};
$dynamic("get$length").HTMLCollection = function() { return this.length; };
$dynamic("$index").HTMLCollection = function(index) {
  return this[index];
}
$dynamic("$setindex").HTMLCollection = function(index, value) {
  $throw(new UnsupportedOperationException("Cannot assign element of immutable List."));
}
$dynamic("iterator").HTMLCollection = function() {
  return new _FixedSizeListIterator_html_Node(this);
}
$dynamic("add").HTMLCollection = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").HTMLCollection = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").HTMLCollection = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").HTMLCollection = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").HTMLCollection = function() {
  return this.get$length() == (0);
}
$dynamic("sort").HTMLCollection = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").HTMLCollection = function(element, start) {
  return _Lists.indexOf(this, element, start, this.get$length());
}
$dynamic("last").HTMLCollection = function() {
  return this.$index(this.get$length() - (1));
}
$dynamic("removeRange").HTMLCollection = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").HTMLCollection = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").HTMLCollection = function($0) {
  return this.add($0);
};
// ********** Code for _HTMLOptionsCollectionImpl **************
$dynamic("is$List").HTMLOptionsCollection = function(){return true};
$dynamic("is$Collection").HTMLOptionsCollection = function(){return true};
$dynamic("get$length").HTMLOptionsCollection = function() {
  return this.length;
}
// ********** Code for _HashChangeEventImpl **************
// ********** Code for _HeadElementImpl **************
$dynamic("is$html_Element").HTMLHeadElement = function(){return true};
// ********** Code for _HeadingElementImpl **************
$dynamic("is$html_Element").HTMLHeadingElement = function(){return true};
// ********** Code for _HighPass2FilterNodeImpl **************
// ********** Code for _HistoryImpl **************
// ********** Code for _HtmlElementImpl **************
$dynamic("is$html_Element").IntentionallyInvalid = function(){return true};
// ********** Code for _IDBAnyImpl **************
// ********** Code for _IDBCursorImpl **************
// ********** Code for _IDBCursorWithValueImpl **************
// ********** Code for _IDBDatabaseImpl **************
// ********** Code for _IDBDatabaseErrorImpl **************
// ********** Code for _IDBDatabaseExceptionImpl **************
// ********** Code for _IDBFactoryImpl **************
// ********** Code for _IDBIndexImpl **************
// ********** Code for _IDBKeyImpl **************
// ********** Code for _IDBKeyRangeImpl **************
// ********** Code for _IDBObjectStoreImpl **************
$dynamic("add$1").IDBObjectStore = function($0) {
  return this.add($0);
};
$dynamic("clear$0").IDBObjectStore = function() {
  return this.clear();
};
// ********** Code for _IDBRequestImpl **************
// ********** Code for _IDBTransactionImpl **************
// ********** Code for _IDBVersionChangeEventImpl **************
// ********** Code for _IDBVersionChangeRequestImpl **************
// ********** Code for _IFrameElementImpl **************
$dynamic("is$html_Element").HTMLIFrameElement = function(){return true};
// ********** Code for _IceCandidateImpl **************
// ********** Code for _ImageDataImpl **************
// ********** Code for _ImageElementImpl **************
$dynamic("is$html_Element").HTMLImageElement = function(){return true};
// ********** Code for _InputElementImpl **************
$dynamic("is$html_Element").HTMLInputElement = function(){return true};
$dynamic("get$on").HTMLInputElement = function() {
  return new _InputElementEventsImpl(this);
}
// ********** Code for _InputElementEventsImpl **************
$inherits(_InputElementEventsImpl, _ElementEventsImpl);
function _InputElementEventsImpl(_ptr) {
  _ElementEventsImpl.call(this, _ptr);
}
// ********** Code for _Int16ArrayImpl **************
var _Int16ArrayImpl = {};
$dynamic("is$List").Int16Array = function(){return true};
$dynamic("is$Collection").Int16Array = function(){return true};
$dynamic("get$length").Int16Array = function() { return this.length; };
$dynamic("$index").Int16Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Int16Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Int16Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Int16Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Int16Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Int16Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Int16Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Int16Array = function() {
  return this.length == (0);
}
$dynamic("sort").Int16Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Int16Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Int16Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Int16Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Int16Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Int16Array = function($0) {
  return this.add($0);
};
// ********** Code for _Int32ArrayImpl **************
var _Int32ArrayImpl = {};
$dynamic("is$List").Int32Array = function(){return true};
$dynamic("is$Collection").Int32Array = function(){return true};
$dynamic("get$length").Int32Array = function() { return this.length; };
$dynamic("$index").Int32Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Int32Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Int32Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Int32Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Int32Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Int32Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Int32Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Int32Array = function() {
  return this.length == (0);
}
$dynamic("sort").Int32Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Int32Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Int32Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Int32Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Int32Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Int32Array = function($0) {
  return this.add($0);
};
// ********** Code for _Int8ArrayImpl **************
var _Int8ArrayImpl = {};
$dynamic("is$List").Int8Array = function(){return true};
$dynamic("is$Collection").Int8Array = function(){return true};
$dynamic("get$length").Int8Array = function() { return this.length; };
$dynamic("$index").Int8Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Int8Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Int8Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Int8Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Int8Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Int8Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Int8Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Int8Array = function() {
  return this.length == (0);
}
$dynamic("sort").Int8Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Int8Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Int8Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Int8Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Int8Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Int8Array = function($0) {
  return this.add($0);
};
// ********** Code for _JavaScriptAudioNodeImpl **************
// ********** Code for _JavaScriptCallFrameImpl **************
// ********** Code for _KeyboardEventImpl **************
// ********** Code for _KeygenElementImpl **************
$dynamic("is$html_Element").HTMLKeygenElement = function(){return true};
// ********** Code for _LIElementImpl **************
$dynamic("is$html_Element").HTMLLIElement = function(){return true};
// ********** Code for _LabelElementImpl **************
$dynamic("is$html_Element").HTMLLabelElement = function(){return true};
// ********** Code for _LegendElementImpl **************
$dynamic("is$html_Element").HTMLLegendElement = function(){return true};
// ********** Code for _LinkElementImpl **************
$dynamic("is$html_Element").HTMLLinkElement = function(){return true};
// ********** Code for _MediaStreamImpl **************
// ********** Code for _LocalMediaStreamImpl **************
// ********** Code for _LocationImpl **************
// ********** Code for _LowPass2FilterNodeImpl **************
// ********** Code for _MapElementImpl **************
$dynamic("is$html_Element").HTMLMapElement = function(){return true};
// ********** Code for _MarqueeElementImpl **************
$dynamic("is$html_Element").HTMLMarqueeElement = function(){return true};
// ********** Code for _MediaControllerImpl **************
// ********** Code for _MediaElementAudioSourceNodeImpl **************
// ********** Code for _MediaErrorImpl **************
// ********** Code for _MediaListImpl **************
$dynamic("is$List").MediaList = function(){return true};
$dynamic("is$Collection").MediaList = function(){return true};
$dynamic("get$length").MediaList = function() { return this.length; };
$dynamic("$index").MediaList = function(index) {
  return this[index];
}
$dynamic("$setindex").MediaList = function(index, value) {
  $throw(new UnsupportedOperationException("Cannot assign element of immutable List."));
}
$dynamic("iterator").MediaList = function() {
  return new _FixedSizeListIterator_dart_core_String(this);
}
$dynamic("add").MediaList = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").MediaList = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").MediaList = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").MediaList = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").MediaList = function() {
  return this.length == (0);
}
$dynamic("sort").MediaList = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").MediaList = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").MediaList = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").MediaList = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").MediaList = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").MediaList = function($0) {
  return this.add($0);
};
// ********** Code for _MediaQueryListImpl **************
// ********** Code for _MediaQueryListListenerImpl **************
// ********** Code for _MediaStreamEventImpl **************
// ********** Code for _MediaStreamListImpl **************
// ********** Code for _MediaStreamTrackImpl **************
// ********** Code for _MediaStreamTrackListImpl **************
// ********** Code for _MemoryInfoImpl **************
// ********** Code for _MenuElementImpl **************
$dynamic("is$html_Element").HTMLMenuElement = function(){return true};
// ********** Code for _MessageChannelImpl **************
// ********** Code for _MessageEventImpl **************
// ********** Code for _MessagePortImpl **************
$dynamic("_addEventListener").MessagePort = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _MetaElementImpl **************
$dynamic("is$html_Element").HTMLMetaElement = function(){return true};
// ********** Code for _MetadataImpl **************
// ********** Code for _MeterElementImpl **************
$dynamic("is$html_Element").HTMLMeterElement = function(){return true};
// ********** Code for _ModElementImpl **************
$dynamic("is$html_Element").HTMLModElement = function(){return true};
// ********** Code for _MouseEventImpl **************
// ********** Code for _MutationEventImpl **************
// ********** Code for _NamedNodeMapImpl **************
$dynamic("is$List").NamedNodeMap = function(){return true};
$dynamic("is$Collection").NamedNodeMap = function(){return true};
$dynamic("get$length").NamedNodeMap = function() { return this.length; };
$dynamic("$index").NamedNodeMap = function(index) {
  return this[index];
}
$dynamic("$setindex").NamedNodeMap = function(index, value) {
  $throw(new UnsupportedOperationException("Cannot assign element of immutable List."));
}
$dynamic("iterator").NamedNodeMap = function() {
  return new _FixedSizeListIterator_html_Node(this);
}
$dynamic("add").NamedNodeMap = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").NamedNodeMap = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").NamedNodeMap = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").NamedNodeMap = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").NamedNodeMap = function() {
  return this.length == (0);
}
$dynamic("sort").NamedNodeMap = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").NamedNodeMap = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").NamedNodeMap = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").NamedNodeMap = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").NamedNodeMap = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").NamedNodeMap = function($0) {
  return this.add($0);
};
// ********** Code for _NavigatorImpl **************
// ********** Code for _NavigatorUserMediaErrorImpl **************
// ********** Code for _NodeFilterImpl **************
// ********** Code for _NodeIteratorImpl **************
// ********** Code for _ListWrapper_Node **************
$inherits(_ListWrapper_Node, _ListWrapper);
function _ListWrapper_Node(_list) {
  this._html_list = _list;
}
_ListWrapper_Node.prototype.is$List = function(){return true};
_ListWrapper_Node.prototype.is$Collection = function(){return true};
_ListWrapper_Node.prototype.add$1 = _ListWrapper_Node.prototype.add;
_ListWrapper_Node.prototype.clear$0 = _ListWrapper_Node.prototype.clear;
// ********** Code for _NodeListWrapper **************
$inherits(_NodeListWrapper, _ListWrapper_Node);
function _NodeListWrapper(list) {
  _ListWrapper_Node.call(this, list);
}
_NodeListWrapper.prototype.is$List = function(){return true};
_NodeListWrapper.prototype.is$Collection = function(){return true};
_NodeListWrapper.prototype.filter = function(f) {
  return new _NodeListWrapper(this._html_list.filter(f));
}
_NodeListWrapper.prototype.getRange = function(start, length) {
  return new _NodeListWrapper(this._html_list.getRange(start, length));
}
// ********** Code for _NodeListImpl **************
$dynamic("is$List").NodeList = function(){return true};
$dynamic("is$Collection").NodeList = function(){return true};
$dynamic("set$_parent").NodeList = function(value) { return this._parent = value; };
$dynamic("iterator").NodeList = function() {
  return new _FixedSizeListIterator_html_Node(this);
}
$dynamic("add").NodeList = function(value) {
  this._parent._appendChild(value);
}
$dynamic("addAll").NodeList = function(collection) {
  for (var $$i = collection.iterator(); $$i.hasNext(); ) {
    var node = $$i.next();
    this._parent._appendChild(node);
  }
}
$dynamic("removeLast").NodeList = function() {
  var last = this.last();
  if ($ne$(last)) {
    this._parent._removeChild(last);
  }
  return last;
}
$dynamic("clear").NodeList = function() {
  this._parent.set$text("");
}
$dynamic("$setindex").NodeList = function(index, value) {
  this._parent._replaceChild(value, this.$index(index));
}
$dynamic("forEach").NodeList = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").NodeList = function(f) {
  return new _NodeListWrapper(_Collections.filter(this, [], f));
}
$dynamic("isEmpty").NodeList = function() {
  return this.length == (0);
}
$dynamic("sort").NodeList = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").NodeList = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").NodeList = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").NodeList = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").NodeList = function(start, length) {
  return new _NodeListWrapper(_Lists.getRange(this, start, length, []));
}
$dynamic("get$length").NodeList = function() { return this.length; };
$dynamic("$index").NodeList = function(index) {
  return this[index];
}
$dynamic("add$1").NodeList = function($0) {
  return this.add($0);
};
$dynamic("clear$0").NodeList = function() {
  return this.clear();
};
// ********** Code for _NodeSelectorImpl **************
// ********** Code for _NotationImpl **************
// ********** Code for _NotificationImpl **************
// ********** Code for _NotificationCenterImpl **************
// ********** Code for _OESStandardDerivativesImpl **************
// ********** Code for _OESTextureFloatImpl **************
// ********** Code for _OESVertexArrayObjectImpl **************
// ********** Code for _OListElementImpl **************
$dynamic("is$html_Element").HTMLOListElement = function(){return true};
// ********** Code for _ObjectElementImpl **************
$dynamic("is$html_Element").HTMLObjectElement = function(){return true};
// ********** Code for _OfflineAudioCompletionEventImpl **************
// ********** Code for _OperationNotAllowedExceptionImpl **************
// ********** Code for _OptGroupElementImpl **************
$dynamic("is$html_Element").HTMLOptGroupElement = function(){return true};
// ********** Code for _OptionElementImpl **************
$dynamic("is$html_Element").HTMLOptionElement = function(){return true};
// ********** Code for _OutputElementImpl **************
$dynamic("is$html_Element").HTMLOutputElement = function(){return true};
// ********** Code for _OverflowEventImpl **************
// ********** Code for _PageTransitionEventImpl **************
// ********** Code for _ParagraphElementImpl **************
$dynamic("is$html_Element").HTMLParagraphElement = function(){return true};
// ********** Code for _ParamElementImpl **************
$dynamic("is$html_Element").HTMLParamElement = function(){return true};
// ********** Code for _PerformanceImpl **************
// ********** Code for _PerformanceNavigationImpl **************
// ********** Code for _PerformanceTimingImpl **************
// ********** Code for _PointImpl **************
// ********** Code for _PopStateEventImpl **************
// ********** Code for _PositionErrorImpl **************
// ********** Code for _PreElementImpl **************
$dynamic("is$html_Element").HTMLPreElement = function(){return true};
// ********** Code for _ProcessingInstructionImpl **************
// ********** Code for _ProgressElementImpl **************
$dynamic("is$html_Element").HTMLProgressElement = function(){return true};
// ********** Code for _ProgressEventImpl **************
// ********** Code for _QuoteElementImpl **************
$dynamic("is$html_Element").HTMLQuoteElement = function(){return true};
// ********** Code for _RGBColorImpl **************
// ********** Code for _RangeImpl **************
// ********** Code for _RangeExceptionImpl **************
// ********** Code for _RealtimeAnalyserNodeImpl **************
// ********** Code for _RectImpl **************
// ********** Code for _SQLErrorImpl **************
// ********** Code for _SQLExceptionImpl **************
// ********** Code for _SQLResultSetImpl **************
// ********** Code for _SQLResultSetRowListImpl **************
// ********** Code for _SQLTransactionImpl **************
// ********** Code for _SQLTransactionSyncImpl **************
// ********** Code for _SVGElementImpl **************
$dynamic("is$html_Element").SVGElement = function(){return true};
$dynamic("get$elements").SVGElement = function() {
  return new FilteredElementList(this);
}
$dynamic("set$elements").SVGElement = function(value) {
  var elements = this.get$elements();
  elements.clear$0();
  elements.addAll(value);
}
$dynamic("set$innerHTML").SVGElement = function(svg) {
  var container = _ElementFactoryProvider.Element$tag$factory("div");
  container.set$innerHTML(("<svg version=\"1.1\">" + svg + "</svg>"));
  this.set$elements(container.get$elements().get$first().get$elements());
}
// ********** Code for _SVGAElementImpl **************
$dynamic("is$html_Element").SVGAElement = function(){return true};
// ********** Code for _SVGAltGlyphDefElementImpl **************
$dynamic("is$html_Element").SVGAltGlyphDefElement = function(){return true};
// ********** Code for _SVGTextContentElementImpl **************
$dynamic("is$html_Element").SVGTextContentElement = function(){return true};
// ********** Code for _SVGTextPositioningElementImpl **************
$dynamic("is$html_Element").SVGTextPositioningElement = function(){return true};
// ********** Code for _SVGAltGlyphElementImpl **************
$dynamic("is$html_Element").SVGAltGlyphElement = function(){return true};
// ********** Code for _SVGAltGlyphItemElementImpl **************
$dynamic("is$html_Element").SVGAltGlyphItemElement = function(){return true};
// ********** Code for _SVGAngleImpl **************
// ********** Code for _SVGAnimationElementImpl **************
$dynamic("is$html_Element").SVGAnimationElement = function(){return true};
// ********** Code for _SVGAnimateColorElementImpl **************
$dynamic("is$html_Element").SVGAnimateColorElement = function(){return true};
// ********** Code for _SVGAnimateElementImpl **************
$dynamic("is$html_Element").SVGAnimateElement = function(){return true};
// ********** Code for _SVGAnimateMotionElementImpl **************
$dynamic("is$html_Element").SVGAnimateMotionElement = function(){return true};
// ********** Code for _SVGAnimateTransformElementImpl **************
$dynamic("is$html_Element").SVGAnimateTransformElement = function(){return true};
// ********** Code for _SVGAnimatedAngleImpl **************
// ********** Code for _SVGAnimatedBooleanImpl **************
// ********** Code for _SVGAnimatedEnumerationImpl **************
// ********** Code for _SVGAnimatedIntegerImpl **************
// ********** Code for _SVGAnimatedLengthImpl **************
// ********** Code for _SVGAnimatedLengthListImpl **************
// ********** Code for _SVGAnimatedNumberImpl **************
// ********** Code for _SVGAnimatedNumberListImpl **************
// ********** Code for _SVGAnimatedPreserveAspectRatioImpl **************
// ********** Code for _SVGAnimatedRectImpl **************
// ********** Code for _SVGAnimatedStringImpl **************
// ********** Code for _SVGAnimatedTransformListImpl **************
// ********** Code for _SVGCircleElementImpl **************
$dynamic("is$html_Element").SVGCircleElement = function(){return true};
// ********** Code for _SVGClipPathElementImpl **************
$dynamic("is$html_Element").SVGClipPathElement = function(){return true};
// ********** Code for _SVGColorImpl **************
// ********** Code for _SVGComponentTransferFunctionElementImpl **************
$dynamic("is$html_Element").SVGComponentTransferFunctionElement = function(){return true};
// ********** Code for _SVGCursorElementImpl **************
$dynamic("is$html_Element").SVGCursorElement = function(){return true};
// ********** Code for _SVGDefsElementImpl **************
$dynamic("is$html_Element").SVGDefsElement = function(){return true};
// ********** Code for _SVGDescElementImpl **************
$dynamic("is$html_Element").SVGDescElement = function(){return true};
// ********** Code for _SVGDocumentImpl **************
$dynamic("is$html_Element").SVGDocument = function(){return true};
// ********** Code for _SVGElementInstanceImpl **************
$dynamic("_addEventListener").SVGElementInstance = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _SVGElementInstanceListImpl **************
// ********** Code for _SVGEllipseElementImpl **************
$dynamic("is$html_Element").SVGEllipseElement = function(){return true};
// ********** Code for _SVGExceptionImpl **************
// ********** Code for _SVGExternalResourcesRequiredImpl **************
// ********** Code for _SVGFEBlendElementImpl **************
$dynamic("is$html_Element").SVGFEBlendElement = function(){return true};
// ********** Code for _SVGFEColorMatrixElementImpl **************
$dynamic("is$html_Element").SVGFEColorMatrixElement = function(){return true};
// ********** Code for _SVGFEComponentTransferElementImpl **************
$dynamic("is$html_Element").SVGFEComponentTransferElement = function(){return true};
// ********** Code for _SVGFECompositeElementImpl **************
$dynamic("is$html_Element").SVGFECompositeElement = function(){return true};
// ********** Code for _SVGFEConvolveMatrixElementImpl **************
$dynamic("is$html_Element").SVGFEConvolveMatrixElement = function(){return true};
// ********** Code for _SVGFEDiffuseLightingElementImpl **************
$dynamic("is$html_Element").SVGFEDiffuseLightingElement = function(){return true};
// ********** Code for _SVGFEDisplacementMapElementImpl **************
$dynamic("is$html_Element").SVGFEDisplacementMapElement = function(){return true};
// ********** Code for _SVGFEDistantLightElementImpl **************
$dynamic("is$html_Element").SVGFEDistantLightElement = function(){return true};
// ********** Code for _SVGFEDropShadowElementImpl **************
$dynamic("is$html_Element").SVGFEDropShadowElement = function(){return true};
// ********** Code for _SVGFEFloodElementImpl **************
$dynamic("is$html_Element").SVGFEFloodElement = function(){return true};
// ********** Code for _SVGFEFuncAElementImpl **************
$dynamic("is$html_Element").SVGFEFuncAElement = function(){return true};
// ********** Code for _SVGFEFuncBElementImpl **************
$dynamic("is$html_Element").SVGFEFuncBElement = function(){return true};
// ********** Code for _SVGFEFuncGElementImpl **************
$dynamic("is$html_Element").SVGFEFuncGElement = function(){return true};
// ********** Code for _SVGFEFuncRElementImpl **************
$dynamic("is$html_Element").SVGFEFuncRElement = function(){return true};
// ********** Code for _SVGFEGaussianBlurElementImpl **************
$dynamic("is$html_Element").SVGFEGaussianBlurElement = function(){return true};
// ********** Code for _SVGFEImageElementImpl **************
$dynamic("is$html_Element").SVGFEImageElement = function(){return true};
// ********** Code for _SVGFEMergeElementImpl **************
$dynamic("is$html_Element").SVGFEMergeElement = function(){return true};
// ********** Code for _SVGFEMergeNodeElementImpl **************
$dynamic("is$html_Element").SVGFEMergeNodeElement = function(){return true};
// ********** Code for _SVGFEMorphologyElementImpl **************
$dynamic("is$html_Element").SVGFEMorphologyElement = function(){return true};
// ********** Code for _SVGFEOffsetElementImpl **************
$dynamic("is$html_Element").SVGFEOffsetElement = function(){return true};
// ********** Code for _SVGFEPointLightElementImpl **************
$dynamic("is$html_Element").SVGFEPointLightElement = function(){return true};
// ********** Code for _SVGFESpecularLightingElementImpl **************
$dynamic("is$html_Element").SVGFESpecularLightingElement = function(){return true};
// ********** Code for _SVGFESpotLightElementImpl **************
$dynamic("is$html_Element").SVGFESpotLightElement = function(){return true};
// ********** Code for _SVGFETileElementImpl **************
$dynamic("is$html_Element").SVGFETileElement = function(){return true};
// ********** Code for _SVGFETurbulenceElementImpl **************
$dynamic("is$html_Element").SVGFETurbulenceElement = function(){return true};
// ********** Code for _SVGFilterElementImpl **************
$dynamic("is$html_Element").SVGFilterElement = function(){return true};
// ********** Code for _SVGStylableImpl **************
// ********** Code for _SVGFilterPrimitiveStandardAttributesImpl **************
// ********** Code for _SVGFitToViewBoxImpl **************
// ********** Code for _SVGFontElementImpl **************
$dynamic("is$html_Element").SVGFontElement = function(){return true};
// ********** Code for _SVGFontFaceElementImpl **************
$dynamic("is$html_Element").SVGFontFaceElement = function(){return true};
// ********** Code for _SVGFontFaceFormatElementImpl **************
$dynamic("is$html_Element").SVGFontFaceFormatElement = function(){return true};
// ********** Code for _SVGFontFaceNameElementImpl **************
$dynamic("is$html_Element").SVGFontFaceNameElement = function(){return true};
// ********** Code for _SVGFontFaceSrcElementImpl **************
$dynamic("is$html_Element").SVGFontFaceSrcElement = function(){return true};
// ********** Code for _SVGFontFaceUriElementImpl **************
$dynamic("is$html_Element").SVGFontFaceUriElement = function(){return true};
// ********** Code for _SVGForeignObjectElementImpl **************
$dynamic("is$html_Element").SVGForeignObjectElement = function(){return true};
// ********** Code for _SVGGElementImpl **************
$dynamic("is$html_Element").SVGGElement = function(){return true};
// ********** Code for _SVGGlyphElementImpl **************
$dynamic("is$html_Element").SVGGlyphElement = function(){return true};
// ********** Code for _SVGGlyphRefElementImpl **************
$dynamic("is$html_Element").SVGGlyphRefElement = function(){return true};
// ********** Code for _SVGGradientElementImpl **************
$dynamic("is$html_Element").SVGGradientElement = function(){return true};
// ********** Code for _SVGHKernElementImpl **************
$dynamic("is$html_Element").SVGHKernElement = function(){return true};
// ********** Code for _SVGImageElementImpl **************
$dynamic("is$html_Element").SVGImageElement = function(){return true};
// ********** Code for _SVGLangSpaceImpl **************
// ********** Code for _SVGLengthImpl **************
// ********** Code for _SVGLengthListImpl **************
$dynamic("clear$0").SVGLengthList = function() {
  return this.clear();
};
// ********** Code for _SVGLineElementImpl **************
$dynamic("is$html_Element").SVGLineElement = function(){return true};
// ********** Code for _SVGLinearGradientElementImpl **************
$dynamic("is$html_Element").SVGLinearGradientElement = function(){return true};
// ********** Code for _SVGLocatableImpl **************
// ********** Code for _SVGMPathElementImpl **************
$dynamic("is$html_Element").SVGMPathElement = function(){return true};
// ********** Code for _SVGMarkerElementImpl **************
$dynamic("is$html_Element").SVGMarkerElement = function(){return true};
// ********** Code for _SVGMaskElementImpl **************
$dynamic("is$html_Element").SVGMaskElement = function(){return true};
// ********** Code for _SVGMatrixImpl **************
// ********** Code for _SVGMetadataElementImpl **************
$dynamic("is$html_Element").SVGMetadataElement = function(){return true};
// ********** Code for _SVGMissingGlyphElementImpl **************
$dynamic("is$html_Element").SVGMissingGlyphElement = function(){return true};
// ********** Code for _SVGNumberImpl **************
// ********** Code for _SVGNumberListImpl **************
$dynamic("clear$0").SVGNumberList = function() {
  return this.clear();
};
// ********** Code for _SVGPaintImpl **************
// ********** Code for _SVGPathElementImpl **************
$dynamic("is$html_Element").SVGPathElement = function(){return true};
// ********** Code for _SVGPathSegImpl **************
// ********** Code for _SVGPathSegArcAbsImpl **************
// ********** Code for _SVGPathSegArcRelImpl **************
// ********** Code for _SVGPathSegClosePathImpl **************
// ********** Code for _SVGPathSegCurvetoCubicAbsImpl **************
// ********** Code for _SVGPathSegCurvetoCubicRelImpl **************
// ********** Code for _SVGPathSegCurvetoCubicSmoothAbsImpl **************
// ********** Code for _SVGPathSegCurvetoCubicSmoothRelImpl **************
// ********** Code for _SVGPathSegCurvetoQuadraticAbsImpl **************
// ********** Code for _SVGPathSegCurvetoQuadraticRelImpl **************
// ********** Code for _SVGPathSegCurvetoQuadraticSmoothAbsImpl **************
// ********** Code for _SVGPathSegCurvetoQuadraticSmoothRelImpl **************
// ********** Code for _SVGPathSegLinetoAbsImpl **************
// ********** Code for _SVGPathSegLinetoHorizontalAbsImpl **************
// ********** Code for _SVGPathSegLinetoHorizontalRelImpl **************
// ********** Code for _SVGPathSegLinetoRelImpl **************
// ********** Code for _SVGPathSegLinetoVerticalAbsImpl **************
// ********** Code for _SVGPathSegLinetoVerticalRelImpl **************
// ********** Code for _SVGPathSegListImpl **************
$dynamic("clear$0").SVGPathSegList = function() {
  return this.clear();
};
// ********** Code for _SVGPathSegMovetoAbsImpl **************
// ********** Code for _SVGPathSegMovetoRelImpl **************
// ********** Code for _SVGPatternElementImpl **************
$dynamic("is$html_Element").SVGPatternElement = function(){return true};
// ********** Code for _SVGPointImpl **************
// ********** Code for _SVGPointListImpl **************
$dynamic("clear$0").SVGPointList = function() {
  return this.clear();
};
// ********** Code for _SVGPolygonElementImpl **************
$dynamic("is$html_Element").SVGPolygonElement = function(){return true};
// ********** Code for _SVGPolylineElementImpl **************
$dynamic("is$html_Element").SVGPolylineElement = function(){return true};
// ********** Code for _SVGPreserveAspectRatioImpl **************
// ********** Code for _SVGRadialGradientElementImpl **************
$dynamic("is$html_Element").SVGRadialGradientElement = function(){return true};
// ********** Code for _SVGRectImpl **************
// ********** Code for _SVGRectElementImpl **************
$dynamic("is$html_Element").SVGRectElement = function(){return true};
// ********** Code for _SVGRenderingIntentImpl **************
// ********** Code for _SVGSVGElementImpl **************
$dynamic("is$html_Element").SVGSVGElement = function(){return true};
// ********** Code for _SVGScriptElementImpl **************
$dynamic("is$html_Element").SVGScriptElement = function(){return true};
// ********** Code for _SVGSetElementImpl **************
$dynamic("is$html_Element").SVGSetElement = function(){return true};
// ********** Code for _SVGStopElementImpl **************
$dynamic("is$html_Element").SVGStopElement = function(){return true};
// ********** Code for _SVGStringListImpl **************
$dynamic("clear$0").SVGStringList = function() {
  return this.clear();
};
// ********** Code for _SVGStyleElementImpl **************
$dynamic("is$html_Element").SVGStyleElement = function(){return true};
// ********** Code for _SVGSwitchElementImpl **************
$dynamic("is$html_Element").SVGSwitchElement = function(){return true};
// ********** Code for _SVGSymbolElementImpl **************
$dynamic("is$html_Element").SVGSymbolElement = function(){return true};
// ********** Code for _SVGTRefElementImpl **************
$dynamic("is$html_Element").SVGTRefElement = function(){return true};
// ********** Code for _SVGTSpanElementImpl **************
$dynamic("is$html_Element").SVGTSpanElement = function(){return true};
// ********** Code for _SVGTestsImpl **************
// ********** Code for _SVGTextElementImpl **************
$dynamic("is$html_Element").SVGTextElement = function(){return true};
// ********** Code for _SVGTextPathElementImpl **************
$dynamic("is$html_Element").SVGTextPathElement = function(){return true};
// ********** Code for _SVGTitleElementImpl **************
$dynamic("is$html_Element").SVGTitleElement = function(){return true};
// ********** Code for _SVGTransformImpl **************
// ********** Code for _SVGTransformListImpl **************
$dynamic("clear$0").SVGTransformList = function() {
  return this.clear();
};
// ********** Code for _SVGTransformableImpl **************
// ********** Code for _SVGURIReferenceImpl **************
// ********** Code for _SVGUnitTypesImpl **************
// ********** Code for _SVGUseElementImpl **************
$dynamic("is$html_Element").SVGUseElement = function(){return true};
// ********** Code for _SVGVKernElementImpl **************
$dynamic("is$html_Element").SVGVKernElement = function(){return true};
// ********** Code for _SVGViewElementImpl **************
$dynamic("is$html_Element").SVGViewElement = function(){return true};
// ********** Code for _SVGZoomAndPanImpl **************
// ********** Code for _SVGViewSpecImpl **************
// ********** Code for _SVGZoomEventImpl **************
// ********** Code for _ScreenImpl **************
// ********** Code for _ScriptElementImpl **************
$dynamic("is$html_Element").HTMLScriptElement = function(){return true};
// ********** Code for _ScriptProfileImpl **************
// ********** Code for _ScriptProfileNodeImpl **************
// ********** Code for _SelectElementImpl **************
$dynamic("is$html_Element").HTMLSelectElement = function(){return true};
// ********** Code for _SessionDescriptionImpl **************
// ********** Code for _ShadowElementImpl **************
$dynamic("is$html_Element").HTMLShadowElement = function(){return true};
// ********** Code for _ShadowRootImpl **************
$dynamic("is$html_Element").ShadowRoot = function(){return true};
$dynamic("set$innerHTML").ShadowRoot = function(value) { return this.innerHTML = value; };
// ********** Code for _SharedWorkerImpl **************
// ********** Code for _SharedWorkerContextImpl **************
// ********** Code for _SourceElementImpl **************
$dynamic("is$html_Element").HTMLSourceElement = function(){return true};
// ********** Code for _SpanElementImpl **************
$dynamic("is$html_Element").HTMLSpanElement = function(){return true};
// ********** Code for _SpeechGrammarImpl **************
// ********** Code for _SpeechGrammarListImpl **************
// ********** Code for _SpeechInputEventImpl **************
// ********** Code for _SpeechInputResultImpl **************
// ********** Code for _SpeechInputResultListImpl **************
// ********** Code for _SpeechRecognitionImpl **************
// ********** Code for _SpeechRecognitionAlternativeImpl **************
// ********** Code for _SpeechRecognitionErrorImpl **************
// ********** Code for _SpeechRecognitionEventImpl **************
// ********** Code for _SpeechRecognitionResultImpl **************
// ********** Code for _SpeechRecognitionResultListImpl **************
// ********** Code for _StorageImpl **************
$dynamic("clear$0").Storage = function() {
  return this.clear();
};
// ********** Code for _StorageEventImpl **************
// ********** Code for _StorageInfoImpl **************
// ********** Code for _StyleElementImpl **************
$dynamic("is$html_Element").HTMLStyleElement = function(){return true};
// ********** Code for _StyleMediaImpl **************
// ********** Code for _StyleSheetListImpl **************
$dynamic("is$List").StyleSheetList = function(){return true};
$dynamic("is$Collection").StyleSheetList = function(){return true};
$dynamic("get$length").StyleSheetList = function() { return this.length; };
$dynamic("$index").StyleSheetList = function(index) {
  return this[index];
}
$dynamic("$setindex").StyleSheetList = function(index, value) {
  $throw(new UnsupportedOperationException("Cannot assign element of immutable List."));
}
$dynamic("iterator").StyleSheetList = function() {
  return new _FixedSizeListIterator_html_StyleSheet(this);
}
$dynamic("add").StyleSheetList = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").StyleSheetList = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").StyleSheetList = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").StyleSheetList = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").StyleSheetList = function() {
  return this.length == (0);
}
$dynamic("sort").StyleSheetList = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").StyleSheetList = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").StyleSheetList = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").StyleSheetList = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").StyleSheetList = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").StyleSheetList = function($0) {
  return this.add($0);
};
// ********** Code for _TableCaptionElementImpl **************
$dynamic("is$html_Element").HTMLTableCaptionElement = function(){return true};
// ********** Code for _TableCellElementImpl **************
$dynamic("is$html_Element").HTMLTableCellElement = function(){return true};
// ********** Code for _TableColElementImpl **************
$dynamic("is$html_Element").HTMLTableColElement = function(){return true};
// ********** Code for _TableElementImpl **************
$dynamic("is$html_Element").HTMLTableElement = function(){return true};
// ********** Code for _TableRowElementImpl **************
$dynamic("is$html_Element").HTMLTableRowElement = function(){return true};
// ********** Code for _TableSectionElementImpl **************
$dynamic("is$html_Element").HTMLTableSectionElement = function(){return true};
// ********** Code for _TextAreaElementImpl **************
$dynamic("is$html_Element").HTMLTextAreaElement = function(){return true};
// ********** Code for _TextEventImpl **************
// ********** Code for _TextMetricsImpl **************
// ********** Code for _TextTrackImpl **************
// ********** Code for _TextTrackCueImpl **************
$dynamic("get$text").TextTrackCue = function() { return this.text; };
// ********** Code for _TextTrackCueListImpl **************
// ********** Code for _TextTrackListImpl **************
// ********** Code for _TimeRangesImpl **************
// ********** Code for _TitleElementImpl **************
$dynamic("is$html_Element").HTMLTitleElement = function(){return true};
// ********** Code for _TouchImpl **************
// ********** Code for _TouchEventImpl **************
// ********** Code for _TouchListImpl **************
$dynamic("is$List").TouchList = function(){return true};
$dynamic("is$Collection").TouchList = function(){return true};
$dynamic("get$length").TouchList = function() { return this.length; };
$dynamic("$index").TouchList = function(index) {
  return this[index];
}
$dynamic("$setindex").TouchList = function(index, value) {
  $throw(new UnsupportedOperationException("Cannot assign element of immutable List."));
}
$dynamic("iterator").TouchList = function() {
  return new _FixedSizeListIterator_html_Touch(this);
}
$dynamic("add").TouchList = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").TouchList = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").TouchList = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").TouchList = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").TouchList = function() {
  return this.length == (0);
}
$dynamic("sort").TouchList = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").TouchList = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").TouchList = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").TouchList = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").TouchList = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").TouchList = function($0) {
  return this.add($0);
};
// ********** Code for _TrackElementImpl **************
$dynamic("is$html_Element").HTMLTrackElement = function(){return true};
// ********** Code for _TrackEventImpl **************
// ********** Code for _TransitionEventImpl **************
// ********** Code for _TreeWalkerImpl **************
// ********** Code for _UListElementImpl **************
$dynamic("is$html_Element").HTMLUListElement = function(){return true};
// ********** Code for _Uint16ArrayImpl **************
var _Uint16ArrayImpl = {};
$dynamic("is$List").Uint16Array = function(){return true};
$dynamic("is$Collection").Uint16Array = function(){return true};
$dynamic("get$length").Uint16Array = function() { return this.length; };
$dynamic("$index").Uint16Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Uint16Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Uint16Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Uint16Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Uint16Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Uint16Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Uint16Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Uint16Array = function() {
  return this.length == (0);
}
$dynamic("sort").Uint16Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Uint16Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Uint16Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Uint16Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Uint16Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Uint16Array = function($0) {
  return this.add($0);
};
// ********** Code for _Uint32ArrayImpl **************
var _Uint32ArrayImpl = {};
$dynamic("is$List").Uint32Array = function(){return true};
$dynamic("is$Collection").Uint32Array = function(){return true};
$dynamic("get$length").Uint32Array = function() { return this.length; };
$dynamic("$index").Uint32Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Uint32Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Uint32Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Uint32Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Uint32Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Uint32Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Uint32Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Uint32Array = function() {
  return this.length == (0);
}
$dynamic("sort").Uint32Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Uint32Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Uint32Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Uint32Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Uint32Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Uint32Array = function($0) {
  return this.add($0);
};
// ********** Code for _Uint8ArrayImpl **************
var _Uint8ArrayImpl = {};
$dynamic("is$List").Uint8Array = function(){return true};
$dynamic("is$Collection").Uint8Array = function(){return true};
$dynamic("get$length").Uint8Array = function() { return this.length; };
$dynamic("$index").Uint8Array = function(index) {
  return this[index];
}
$dynamic("$setindex").Uint8Array = function(index, value) {
  this[index] = value
}
$dynamic("iterator").Uint8Array = function() {
  return new _FixedSizeListIterator_int(this);
}
$dynamic("add").Uint8Array = function(value) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("addAll").Uint8Array = function(collection) {
  $throw(new UnsupportedOperationException("Cannot add to immutable List."));
}
$dynamic("forEach").Uint8Array = function(f) {
  return _Collections.forEach(this, f);
}
$dynamic("filter").Uint8Array = function(f) {
  return _Collections.filter(this, [], f);
}
$dynamic("isEmpty").Uint8Array = function() {
  return this.length == (0);
}
$dynamic("sort").Uint8Array = function(compare) {
  $throw(new UnsupportedOperationException("Cannot sort immutable List."));
}
$dynamic("indexOf").Uint8Array = function(element, start) {
  return _Lists.indexOf(this, element, start, this.length);
}
$dynamic("last").Uint8Array = function() {
  return this.$index(this.length - (1));
}
$dynamic("removeRange").Uint8Array = function(start, length) {
  $throw(new UnsupportedOperationException("Cannot removeRange on immutable List."));
}
$dynamic("getRange").Uint8Array = function(start, length) {
  return _Lists.getRange(this, start, length, []);
}
$dynamic("add$1").Uint8Array = function($0) {
  return this.add($0);
};
// ********** Code for _Uint8ClampedArrayImpl **************
var _Uint8ClampedArrayImpl = {};
$dynamic("is$List").Uint8ClampedArray = function(){return true};
$dynamic("is$Collection").Uint8ClampedArray = function(){return true};
// ********** Code for _UnknownElementImpl **************
$dynamic("is$html_Element").HTMLUnknownElement = function(){return true};
// ********** Code for _ValidityStateImpl **************
// ********** Code for _VideoElementImpl **************
$dynamic("is$html_Element").HTMLVideoElement = function(){return true};
// ********** Code for _WaveShaperNodeImpl **************
// ********** Code for _WebGLActiveInfoImpl **************
// ********** Code for _WebGLBufferImpl **************
// ********** Code for _WebGLCompressedTextureS3TCImpl **************
// ********** Code for _WebGLContextAttributesImpl **************
// ********** Code for _WebGLContextEventImpl **************
// ********** Code for _WebGLDebugRendererInfoImpl **************
// ********** Code for _WebGLDebugShadersImpl **************
// ********** Code for _WebGLFramebufferImpl **************
// ********** Code for _WebGLLoseContextImpl **************
// ********** Code for _WebGLProgramImpl **************
// ********** Code for _WebGLRenderbufferImpl **************
// ********** Code for _WebGLRenderingContextImpl **************
// ********** Code for _WebGLShaderImpl **************
// ********** Code for _WebGLTextureImpl **************
// ********** Code for _WebGLUniformLocationImpl **************
// ********** Code for _WebGLVertexArrayObjectOESImpl **************
// ********** Code for _WebKitCSSRegionRuleImpl **************
// ********** Code for _WebKitNamedFlowImpl **************
// ********** Code for _WebSocketImpl **************
$dynamic("_addEventListener").WebSocket = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _WheelEventImpl **************
// ********** Code for _WindowImpl **************
$dynamic("_addEventListener").DOMWindow = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _WorkerImpl **************
// ********** Code for _WorkerLocationImpl **************
// ********** Code for _WorkerNavigatorImpl **************
// ********** Code for _XMLHttpRequestImpl **************
$dynamic("_addEventListener").XMLHttpRequest = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _XMLHttpRequestExceptionImpl **************
// ********** Code for _XMLHttpRequestProgressEventImpl **************
// ********** Code for _XMLHttpRequestUploadImpl **************
$dynamic("_addEventListener").XMLHttpRequestUpload = function(type, listener, useCapture) {
  this.addEventListener(type, listener, useCapture);
}
// ********** Code for _XMLSerializerImpl **************
// ********** Code for _XPathEvaluatorImpl **************
// ********** Code for _XPathExceptionImpl **************
// ********** Code for _XPathExpressionImpl **************
// ********** Code for _XPathNSResolverImpl **************
// ********** Code for _XPathResultImpl **************
// ********** Code for _XSLTProcessorImpl **************
// ********** Code for _Collections **************
function _Collections() {}
_Collections.forEach = function(iterable, f) {
  for (var $$i = iterable.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    f(e);
  }
}
_Collections.filter = function(source, destination, f) {
  for (var $$i = source.iterator(); $$i.hasNext(); ) {
    var e = $$i.next();
    if (f(e)) destination.add(e);
  }
  return destination;
}
// ********** Code for _ElementFactoryProvider **************
function _ElementFactoryProvider() {}
_ElementFactoryProvider.Element$tag$factory = function(tag) {
  return get$$_document()._createElement(tag);
}
// ********** Code for _PointFactoryProvider **************
function _PointFactoryProvider() {}
_PointFactoryProvider.Point$factory = function(x, y) {
  return new WebKitPoint(x, y);
}
// ********** Code for _VariableSizeListIterator **************
function _VariableSizeListIterator() {}
_VariableSizeListIterator.prototype.hasNext = function() {
  return this._html_array.get$length() > this._html_pos;
}
_VariableSizeListIterator.prototype.next = function() {
  if (!this.hasNext()) {
    $throw(const$0001);
  }
  return this._html_array.$index(this._html_pos++);
}
// ********** Code for _FixedSizeListIterator **************
$inherits(_FixedSizeListIterator, _VariableSizeListIterator);
function _FixedSizeListIterator() {}
_FixedSizeListIterator.prototype.hasNext = function() {
  return this._html_length > this._html_pos;
}
// ********** Code for _VariableSizeListIterator_dart_core_String **************
$inherits(_VariableSizeListIterator_dart_core_String, _VariableSizeListIterator);
function _VariableSizeListIterator_dart_core_String(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_dart_core_String **************
$inherits(_FixedSizeListIterator_dart_core_String, _FixedSizeListIterator);
function _FixedSizeListIterator_dart_core_String(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_dart_core_String.call(this, array);
}
// ********** Code for _VariableSizeListIterator_int **************
$inherits(_VariableSizeListIterator_int, _VariableSizeListIterator);
function _VariableSizeListIterator_int(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_int **************
$inherits(_FixedSizeListIterator_int, _FixedSizeListIterator);
function _FixedSizeListIterator_int(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_int.call(this, array);
}
// ********** Code for _VariableSizeListIterator_num **************
$inherits(_VariableSizeListIterator_num, _VariableSizeListIterator);
function _VariableSizeListIterator_num(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_num **************
$inherits(_FixedSizeListIterator_num, _FixedSizeListIterator);
function _FixedSizeListIterator_num(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_num.call(this, array);
}
// ********** Code for _VariableSizeListIterator_html_Node **************
$inherits(_VariableSizeListIterator_html_Node, _VariableSizeListIterator);
function _VariableSizeListIterator_html_Node(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_html_Node **************
$inherits(_FixedSizeListIterator_html_Node, _FixedSizeListIterator);
function _FixedSizeListIterator_html_Node(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_html_Node.call(this, array);
}
// ********** Code for _VariableSizeListIterator_html_StyleSheet **************
$inherits(_VariableSizeListIterator_html_StyleSheet, _VariableSizeListIterator);
function _VariableSizeListIterator_html_StyleSheet(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_html_StyleSheet **************
$inherits(_FixedSizeListIterator_html_StyleSheet, _FixedSizeListIterator);
function _FixedSizeListIterator_html_StyleSheet(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_html_StyleSheet.call(this, array);
}
// ********** Code for _VariableSizeListIterator_html_Touch **************
$inherits(_VariableSizeListIterator_html_Touch, _VariableSizeListIterator);
function _VariableSizeListIterator_html_Touch(array) {
  this._html_array = array;
  this._html_pos = (0);
}
// ********** Code for _FixedSizeListIterator_html_Touch **************
$inherits(_FixedSizeListIterator_html_Touch, _FixedSizeListIterator);
function _FixedSizeListIterator_html_Touch(array) {
  this._html_length = array.get$length();
  _VariableSizeListIterator_html_Touch.call(this, array);
}
// ********** Code for _Lists **************
function _Lists() {}
_Lists.indexOf = function(a, element, startIndex, endIndex) {
  if (startIndex >= a.get$length()) {
    return (-1);
  }
  if (startIndex < (0)) {
    startIndex = (0);
  }
  for (var i = startIndex;
   i < endIndex; i++) {
    if ($eq$(a.$index(i), element)) {
      return i;
    }
  }
  return (-1);
}
_Lists.getRange = function(a, start, length, accumulator) {
  if (length < (0)) $throw(new IllegalArgumentException("length"));
  if (start < (0)) $throw(new IndexOutOfRangeException(start));
  var end = start + length;
  if (end > a.get$length()) $throw(new IndexOutOfRangeException(end));
  for (var i = start;
   i < end; i++) {
    accumulator.add(a.$index(i));
  }
  return accumulator;
}
// ********** Code for top level **************
var _cachedWindow;
var _cachedDocument;
function _init() {
  $globals._cachedDocument = get$$_document();
  $globals._cachedWindow = get$$_window();
  var element = _ElementFactoryProvider.Element$tag$factory("body");
  element.set$innerHTML("f");
  if (element.get$text() == "") {
    $globals._cachedWindow.console.error("Cannot import dart:html and dart:dom within the same application.");
    $throw(new UnsupportedOperationException("Cannot import dart:html and dart:dom within the same application."));
  }
}
function get$$window() {
  if ($globals._cachedWindow == null) {
    _init();
  }
  return $globals._cachedWindow;
}
function get$$_window() {
  return window;
}
function get$$document() {
  if ($globals._cachedDocument == null) {
    _init();
  }
  return $globals._cachedDocument;
}
function get$$_document() {
  return window.document.documentElement;
}
var _cachedBrowserPrefix;
var _pendingRequests;
var _pendingMeasurementFrameCallbacks;
//  ********** Library json **************
// ********** Code for _JSON **************
_JSON = JSON;
// ********** Code for json_JSON **************
function json_JSON() {}
json_JSON.parse = function(str) {
  return _JSON.parse(str, (function (_, obj) {
    var keys = _jsKeys(obj);
    if ($eq$(keys)) return obj;
    var map = new HashMapImplementation();
    for (var $$i = keys.iterator(); $$i.hasNext(); ) {
      var key = $$i.next();
      map.$setindex(key, _getValue(obj, key));
    }
    return map;
  })
  );
}
json_JSON.stringify = function(value) {
  return _JSON.stringify(value, (function (_, obj) {
    if (_directToJson(obj)) return obj;
    if (!!(obj && obj.is$Map_dart_core_String$Dynamic())) {
      var map = obj;
      obj = new Object();
      map.forEach((function (k, v) {
        return _setValue(obj, k, v);
      })
      );
      return obj;
    }
    $throw(new IllegalArgumentException(("cannot convert \"" + value + "\" to JSON")));
  })
  );
}
// ********** Code for top level **************
function _getValue(obj, key) {
  return obj[key]
}
function _setValue(obj, key, value) {
  obj[key] = value
}
function _directToJson(obj) {
  return typeof obj != 'object' || obj == null || obj instanceof Array
}
function _jsKeys(obj) {
  if (obj != null && typeof obj == 'object' && !(obj instanceof Array)) {
  return Object.keys(obj);
  }
  return null;
}
//  ********** Library C:\Users\ridjanod\git\dart\learn\MagicBoxes\MagicBoxes **************
// ********** Code for Box **************
function Box(board, x, y, width, height) {
  this._name = "";
  this.entry = false;
  this._selected = false;
  this._hidden = false;
  this._mouseDown = false;
  this.board = board;
  this.x = x;
  this.y = y;
  this.width = width;
  this.height = height;
  this.items = new Array();
  this.draw();
  get$$document().query("#canvas").get$on().get$mouseDown().add(this.get$onMouseDown(), false);
  get$$document().query("#canvas").get$on().get$mouseUp().add(this.get$onMouseUp(), false);
  get$$document().query("#canvas").get$on().get$mouseMove().add(this.get$onMouseMove(), false);
}
Box.prototype.draw = function() {
  if (!this.isHidden()) {
    this.board.context.beginPath();
    this.board.context.clearRect(this.x, this.y, this.width, this.height);
    this.board.context.rect(this.x, this.y, this.width, this.height);
    this.board.context.moveTo(this.x, this.y + (20));
    this.board.context.lineTo(this.x + this.width, this.y + (20));
    this.board.context.font = $add$("bold " + (12), "px sans-serif");
    this.board.context.textAlign = "start";
    this.board.context.textBaseline = "top";
    if (this.entry) {
      this.board.context.fillText($add$("|| ", this.get$title()), this.x + (4), this.y + (4), this.width - (4));
    }
    else {
      this.board.context.fillText(this.get$title(), this.x + (4), this.y + (4), this.width - (4));
    }
    this.sortItemsBySequence();
    var i = (0);
    var $$list = this.items;
    for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
      var item = $$i.next();
      if (item.category == "attribute") {
        this.board.context.font = $add$("" + (12), "px sans-serif");
        this.board.context.fillText(item.name, this.x + (4), this.y + (4) + (20) + i * (16), this.width - (4));
      }
      else if (item.category == "guid") {
        this.board.context.font = $add$("italic " + (12), "px sans-serif");
        this.board.context.fillText(item.name, this.x + (4), this.y + (4) + (20) + i * (16), this.width - (4));
      }
      else if (item.category == "identifier") {
        this.board.context.font = $add$("bold italic " + (12), "px sans-serif");
        this.board.context.fillText(item.name, this.x + (4), this.y + (4) + (20) + i * (16), this.width - (4));
      }
      else if (item.category == "required") {
        this.board.context.font = $add$("bold " + (12), "px sans-serif");
        this.board.context.fillText(item.name, this.x + (4), this.y + (4) + (20) + i * (16), this.width - (4));
      }
      i++;
    }
    if (this.isSelected()) {
      this.board.context.rect(this.x, this.y, (6), (6));
      this.board.context.rect(this.x + this.width - (6), this.y, (6), (6));
      this.board.context.rect(this.x + this.width - (6), this.y + this.height - (6), (6), (6));
      this.board.context.rect(this.x, this.y + this.height - (6), (6), (6));
    }
    this.board.context.lineWidth = (1);
    this.board.context.strokeStyle = "#000000";
    this.board.context.stroke();
    this.board.context.closePath();
  }
}
Box.prototype.select = function() {
  this._selected = true;
  this.board.lastBoxSelected = this;
  this.board.toolBar.bringSelectedBox();
}
Box.prototype.deselect = function() {
  this._selected = false;
  this.board.lastBoxSelected = null;
}
Box.prototype.toggleSelection = function() {
  if (this.isSelected()) {
    this.deselect();
  }
  else {
    this.select();
  }
}
Box.prototype.isSelected = function() {
  return this._selected;
}
Box.prototype.hide = function() {
  var $0;
  return (this._hidden = ($0 = true), $0);
}
Box.prototype.show = function() {
  var $0;
  return (this._hidden = ($0 = false), $0);
}
Box.prototype.isHidden = function() {
  return this._hidden;
}
Box.prototype.get$title = function() {
  return this._name;
}
Box.prototype.set$title = function(name) {
  this._name = name;
}
Box.prototype.toJson = function() {
  var boxMap = new HashMapImplementation_dart_core_String$Object();
  boxMap.$setindex("name", this.get$title());
  boxMap.$setindex("entry", this.entry);
  boxMap.$setindex("x", this.x);
  boxMap.$setindex("y", this.y);
  boxMap.$setindex("width", this.width);
  boxMap.$setindex("height", this.height);
  boxMap.$setindex("items", this.itemsToJson());
  return boxMap;
}
Box.prototype.itemsToJson = function() {
  var itemsList = new Array();
  var $$list = this.items;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var item = $$i.next();
    itemsList.add(item.toJson());
  }
  return itemsList;
}
Box.prototype.findLastItemSequence = function() {
  if (this.items.isEmpty()) {
    return (0);
  }
  else {
    var item = this.items.last();
    return item.sequence;
  }
}
Box.prototype.findItem = function(name) {
  var $$list = this.items;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var item = $$i.next();
    if (item.name == name) {
      return item;
    }
  }
  return null;
}
Box.prototype.findFirstItem = function() {
  if (this.items.isEmpty()) {
    return null;
  }
  else {
    return this.items.$index((0));
  }
}
Box.prototype.findLastItem = function() {
  if (this.items.isEmpty()) {
    return null;
  }
  else {
    return this.items.last();
  }
}
Box.prototype.findPreviousItem = function(currentItem) {
  this.sortItemsBySequence();
  var $$list = this.items;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var item = $$i.next();
    if ($eq$(item, currentItem)) {
      var ix = this.items.indexOf(item, (0));
      if (ix > (0)) {
        return this.items.$index(ix - (1));
      }
    }
  }
  return null;
}
Box.prototype.findNextItem = function(currentItem) {
  this.sortItemsBySequence();
  var $$list = this.items;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var item = $$i.next();
    if ($eq$(item, currentItem)) {
      var ix = this.items.indexOf(item, (0));
      if (ix < this.items.get$length() - (1)) {
        return this.items.$index(ix + (1));
      }
    }
  }
  return null;
}
Box.prototype.removeItem = function(item) {
  if (item != null) {
    var index = this.items.indexOf(item, (0));
    if (index >= (0)) {
      this.items.removeRange(index, (1));
      return true;
    }
  }
  return false;
}
Box.prototype.sortItemsBySequence = function() {
  this.items.sort(function compare(i1, i2) {
    if (i1.sequence == i2.sequence) {
      return (0);
    }
    else if (i1.sequence > i2.sequence) {
      return (1);
    }
    else {
      return (-1);
    }
  }
  );
}
Box.prototype.toString = function() {
  return ("" + this.get$title() + " (" + this.x + ", " + this.y + ")");
}
Box.prototype.center = function() {
  var centerX = this.x + this.width / (2);
  var centerY = this.y + this.height / (2);
  return _PointFactoryProvider.Point$factory(centerX, centerY);
}
Box.prototype.twin1 = function() {
  var twinX = this.x + this.width / (4);
  var twinY = this.y + this.height / (4);
  return _PointFactoryProvider.Point$factory(twinX, twinY);
}
Box.prototype.twin2 = function() {
  var twinX = this.x + (this.width / (4)) * (3);
  var twinY = this.y + (this.height / (4)) * (3);
  return _PointFactoryProvider.Point$factory(twinX, twinY);
}
Box.prototype.reflexive1 = function() {
  var reflexiveX = this.x;
  var reflexiveY = this.y - this.height / (2);
  return _PointFactoryProvider.Point$factory(reflexiveX, reflexiveY);
}
Box.prototype.reflexive2 = function() {
  var reflexiveX = this.x + this.width;
  var reflexiveY = this.y - this.height / (2);
  return _PointFactoryProvider.Point$factory(reflexiveX, reflexiveY);
}
Box.prototype.contains = function(pointX, pointY) {
  if ((pointX > this.x && pointX < this.x + this.width) && (pointY > this.y && pointY < this.y + this.height)) {
    return true;
  }
  else {
    return false;
  }
}
Box.prototype.getIntersectionPoint = function(lineBeginPoint, lineEndPoint) {
  var x1 = lineBeginPoint.x;
  var y1 = lineBeginPoint.y;
  var x2 = lineEndPoint.x;
  var y2 = lineEndPoint.y;
  if (x2 == x1) return _PointFactoryProvider.Point$factory(x2, (y2 < y1 ? this.y : this.y + this.height));
  if (y2 == y1) return _PointFactoryProvider.Point$factory((x2 < x1 ? this.x : this.x + this.width), y2);
  var m = (y2 - y1) / (x2 - x1);
  var x = (x2 < x1 ? this.x : this.x + this.width);
  var fy = m * (x - x2) + y2;
  var y;
  if (fy >= this.y && fy <= this.y + this.height) {
    y = fy.toInt();
  }
  else {
    y = (y2 < y1 ? this.y : this.y + this.height);
    x = ((fy - y2) / m).toInt() + x2;
  }
  return _PointFactoryProvider.Point$factory(x, y);
}
Box.prototype.onMouseDown = function(e) {
  this._mouseDown = true;
  if (this.board.toolBar.isSelectToolOn() && this.contains(e.offsetX, e.offsetY)) {
    this.toggleSelection();
  }
  if (this.contains(e.offsetX, e.offsetY)) {
    if (this.board.lastBoxClicked != null && $ne$(this.board.lastBoxClicked, this)) {
      this.board.beforeLastBoxClicked = this.board.lastBoxClicked;
    }
    this.board.lastBoxClicked = this;
  }
}
Box.prototype.get$onMouseDown = function() {
  return this.onMouseDown.bind(this);
}
Box.prototype.onMouseUp = function(e) {
  this._mouseDown = false;
}
Box.prototype.get$onMouseUp = function() {
  return this.onMouseUp.bind(this);
}
Box.prototype.onMouseMove = function(e) {
  if (this.contains(e.offsetX, e.offsetY) && this._mouseDown && this.board.countBoxesContain(e.offsetX, e.offsetY) < (2)) {
    this.x = e.offsetX - this.width / (2);
    if (this.x < (0)) {
      this.x = (1);
    }
    if (this.x > this.board.get$width() - this.width) {
      this.x = this.board.get$width() - this.width - (1);
    }
    this.y = e.offsetY - this.height / (2);
    if (this.y < (0)) {
      this.y = (1);
    }
    if (this.y > this.board.get$height() - this.height) {
      this.y = this.board.get$height() - this.height - (1);
    }
  }
}
Box.prototype.get$onMouseMove = function() {
  return this.onMouseMove.bind(this);
}
// ********** Code for Board **************
function Board(canvas) {
  this.canvas = canvas;
  this.context = this.canvas.getContext("2d");
  this._width = this.canvas.width;
  this._height = this.canvas.height;
  this.border();
  this.boxes = new Array();
  this.lines = new Array();
  this.menuBar = new MenuBar(this);
  this.toolBar = new ToolBar(this);
  this.jsonPanel = new JsonPanel(this);
  this.pngPanel = new PngPanel(this);
  get$$document().query("#canvas").get$on().get$mouseDown().add(this.get$onMouseDown(), false);
  get$$document().get$window().setInterval(this.get$redraw(), (8));
}
Board.prototype.get$width = function() {
  return this._width;
}
Board.prototype.set$width = function(width) {
  this._width = width;
  this.canvas.width = width;
}
Board.prototype.get$height = function() {
  return this._height;
}
Board.prototype.set$height = function(height) {
  this._height = height;
  this.canvas.height = height;
}
Board.prototype.openModel = function(name) {
  var json = get$$window().localStorage.getItem(name);
  if (json != null) {
    this.fromJson(json);
  }
}
Board.prototype.saveModel = function(name) {
  var json = this.toJson();
  if (json != null) {
    get$$window().localStorage.setItem(name, json);
  }
}
Board.prototype.closeModel = function() {
  this.delete_();
  this.jsonPanel.clear();
  this.pngPanel.hide();
}
Board.prototype.toJson = function() {
  var boardMap = new HashMapImplementation_dart_core_String$Object();
  boardMap.$setindex("width", this.get$width());
  boardMap.$setindex("height", this.get$height());
  boardMap.$setindex("boxes", this.boxesToJson());
  boardMap.$setindex("lines", this.linesToJson());
  return json_JSON.stringify(boardMap);
}
Board.prototype.fromJson = function(json) {
  var boardMap = json_JSON.parse(json);
  this.set$width(boardMap.$index("width"));
  this.set$height(boardMap.$index("height"));
  var boxesList = boardMap.$index("boxes");
  this.boxesFromJson(boxesList);
  var linesList = boardMap.$index("lines");
  this.linesFromJson(linesList);
}
Board.prototype.boxesToJson = function() {
  var boxesList = new Array();
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (!box.isHidden()) {
      boxesList.add(box.toJson());
    }
  }
  return boxesList;
}
Board.prototype.linesToJson = function() {
  var linesList = new Array();
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (!line.isHidden()) {
      linesList.add(line.toJson());
    }
  }
  return linesList;
}
Board.prototype.boxesFromJson = function(boxesList) {
  this.boxes = new Array();
  for (var $$i = boxesList.iterator(); $$i.hasNext(); ) {
    var jsonBox = $$i.next();
    this.boxes.add(this.boxFromJson(jsonBox));
  }
}
Board.prototype.boxFromJson = function(boxMap) {
  var title = boxMap.$index("name");
  var entry = boxMap.$index("entry");
  var xText = boxMap.$index("x");
  var x = Math.parseInt(xText);
  var yText = boxMap.$index("y");
  var y = Math.parseInt(yText);
  var widthText = boxMap.$index("width");
  var width = Math.parseInt(widthText);
  var heightText = boxMap.$index("height");
  var height = Math.parseInt(heightText);
  var box = new Box(this, x, y, width, height);
  box.set$title(title);
  box.entry = entry;
  var itemsList = boxMap.$index("items");
  for (var $$i = itemsList.iterator(); $$i.hasNext(); ) {
    var jsonItem = $$i.next();
    this.itemFromJson(box, jsonItem);
  }
  return box;
}
Board.prototype.itemFromJson = function(box, itemMap) {
  var name = itemMap.$index("name");
  var category = itemMap.$index("category");
  var item = new Item(box, name, category);
  var sequenceText = itemMap.$index("sequence");
  var sequence = Math.parseInt(sequenceText);
  item.sequence = sequence;
  item.type = itemMap.$index("type");
  item.init = itemMap.$index("init");
}
Board.prototype.linesFromJson = function(linesList) {
  this.lines = new Array();
  for (var $$i = linesList.iterator(); $$i.hasNext(); ) {
    var jsonLine = $$i.next();
    var line = this.lineFromJson(jsonLine);
    if (line != null) {
      this.lines.add(line);
    }
  }
}
Board.prototype.lineFromJson = function(lineMap) {
  var box1Name = lineMap.$index("box1Name");
  var box2Name = lineMap.$index("box2Name");
  var box1 = this.findBox(box1Name);
  var box2 = this.findBox(box2Name);
  if (box1 != null && box2 != null) {
    var line = new Line(this, box1, box2);
    line.set$category(lineMap.$index("category"));
    line.internal = lineMap.$index("internal");
    var box1box2Name = lineMap.$index("box1box2Name");
    var box1box2Min = lineMap.$index("box1box2Min");
    var box1box2Max = lineMap.$index("box1box2Max");
    var box1box2Id = lineMap.$index("box1box2Id");
    line.box1box2Name = box1box2Name;
    line.box1box2Min = box1box2Min;
    line.box1box2Max = box1box2Max;
    line.box1box2Id = box1box2Id;
    var box2box1Name = lineMap.$index("box2box1Name");
    var box2box1Min = lineMap.$index("box2box1Min");
    var box2box1Max = lineMap.$index("box2box1Max");
    var box2box1Id = lineMap.$index("box2box1Id");
    line.box2box1Name = box2box1Name;
    line.box2box1Min = box2box1Min;
    line.box2box1Max = box2box1Max;
    line.box2box1Id = box2box1Id;
    return line;
  }
  return null;
}
Board.prototype.border = function() {
  this.context.beginPath();
  this.context.rect((0), (0), this.get$width(), this.get$height());
  this.context.lineWidth = (1);
  this.context.strokeStyle = "#000000";
  this.context.stroke();
  this.context.closePath();
}
Board.prototype.clear = function() {
  this.context.clearRect((0), (0), this.get$width(), this.get$height());
  this.border();
}
Board.prototype.redraw = function() {
  this.clear();
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    line.draw();
  }
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    box.draw();
  }
}
Board.prototype.get$redraw = function() {
  return this.redraw.bind(this);
}
Board.prototype.createBoxesInDiagonal = function() {
  var x = (0);
  var y = (0);
  while (true) {
    if (x <= this.get$width() - (120) && y <= this.get$height() - (120)) {
      var box = new Box(this, x, y, (120), (120));
      this.boxes.add(box);
      x = x + (120);
      y = y + (120);
    }
    else {
      return;
    }
  }
}
Board.prototype.createBoxesAsTiles = function() {
  var x = (0);
  var y = (0);
  while (true) {
    if (x <= this.get$width() - (120)) {
      var box = new Box(this, x, y, (120), (120));
      this.boxes.add(box);
      x = x + (240);
    }
    else {
      x = (0);
      y = y + (240);
      if (y > this.get$height() - (120)) {
        return;
      }
    }
  }
}
Board.prototype.deleteBoxes = function() {
  this.boxes.clear();
}
Board.prototype.deleteLines = function() {
  this.lines.clear();
}
Board.prototype.delete_ = function() {
  this.deleteLines();
  this.deleteBoxes();
  this.toolBar.backToSelectAsFixedTool();
}
Board.prototype.deleteBox = function(boxToDelete) {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if ($eq$(box, boxToDelete)) {
      var index = this.boxes.indexOf(box, (0));
      this.boxes.removeRange(index, (1));
      if ($eq$(box, this.beforeLastBoxClicked)) {
        this.beforeLastBoxClicked == null;
      }
      else if ($eq$(box, this.lastBoxClicked)) {
        this.lastBoxClicked == null;
      }
      return;
    }
  }
}
Board.prototype.deleteLine = function(lineToDelete) {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if ($eq$(line, lineToDelete)) {
      var index = this.lines.indexOf(line, (0));
      this.lines.removeRange(index, (1));
      return;
    }
  }
}
Board.prototype.deleteSelectedBoxes = function() {
  if (this.countSelectedBoxes() == (0)) {
    return;
  }
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      this.deleteBox(box);
    }
  }
  this.deleteSelectedBoxes();
}
Board.prototype.deleteSelectedLines = function() {
  if (this.countSelectedLines() == (0)) {
    return;
  }
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.isSelected()) {
      this.deleteLine(line);
    }
  }
  this.deleteSelectedLines();
}
Board.prototype.deleteSelection = function() {
  this.deleteSelectedLines();
  this.deleteSelectedBoxes();
  if (this.isEmpty()) {
    this.toolBar.backToSelectAsFixedTool();
  }
}
Board.prototype.isEmpty = function() {
  if (this.boxes.get$length() == (0) && this.lines.get$length() == (0)) {
    return true;
  }
  return false;
}
Board.prototype.selectBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    box.select();
  }
}
Board.prototype.selectLines = function() {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    line.select();
  }
}
Board.prototype.selectBoxLines = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      var $list0 = this.lines;
      for (var $i0 = $list0.iterator(); $i0.hasNext(); ) {
        var line = $i0.next();
        if ($eq$(line.box1, box) || $eq$(line.box2, box)) {
          line.select();
        }
      }
    }
  }
}
Board.prototype.selectLinesBetweenBoxes = function() {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.box1.isSelected() && line.box2.isSelected()) {
      line.select();
    }
  }
}
Board.prototype.select = function() {
  this.selectBoxes();
  this.selectLines();
}
Board.prototype.deselectBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    box.deselect();
  }
}
Board.prototype.deselectLines = function() {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    line.deselect();
  }
}
Board.prototype.deselect = function() {
  this.deselectBoxes();
  this.deselectLines();
}
Board.prototype.increaseHeightOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.height = box.height + (20);
    }
  }
}
Board.prototype.decreaseHeightOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.height = box.height - (20);
    }
  }
}
Board.prototype.increaseWidthOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.width = box.width + (20);
    }
  }
}
Board.prototype.decreaseWidthOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.width = box.width - (20);
    }
  }
}
Board.prototype.increaseSizeOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.height = box.height + (20);
      box.width = box.width + (20);
    }
  }
}
Board.prototype.decreaseSizeOfSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.height = box.height - (20);
      box.width = box.width - (20);
    }
  }
}
Board.prototype.hideSelectedBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      box.hide();
    }
  }
}
Board.prototype.hideSelectedLines = function() {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.isSelected()) {
      line.hide();
    }
  }
}
Board.prototype.hideSelection = function() {
  this.hideSelectedBoxes();
  this.hideSelectedLines();
}
Board.prototype.showHiddenBoxes = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isHidden()) {
      box.show();
    }
  }
}
Board.prototype.showHiddenLines = function() {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.isHidden()) {
      line.show();
    }
  }
}
Board.prototype.showHidden = function() {
  this.showHiddenBoxes();
  this.showHiddenLines();
}
Board.prototype.hideNonSelection = function() {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (!box.isSelected()) {
      box.hide();
    }
  }
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (!line.isSelected()) {
      line.hide();
    }
  }
}
Board.prototype.countSelectedBoxes = function() {
  var count = (0);
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.isSelected()) {
      count++;
    }
  }
  return count;
}
Board.prototype.countSelectedLines = function() {
  var count = (0);
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.isSelected()) {
      count++;
    }
  }
  return count;
}
Board.prototype.countBoxesContain = function(pointX, pointY) {
  var count = (0);
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.contains(pointX, pointY)) {
      count++;
    }
  }
  return count;
}
Board.prototype.countLinesBetween = function(box1, box2) {
  var count = (0);
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (($eq$(line.box1, box1) && $eq$(line.box2, box2)) || ($eq$(line.box1, box2) && $eq$(line.box2, box1))) {
      count++;
    }
  }
  return count;
}
Board.prototype.findBox = function(boxName) {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.get$title() == boxName) {
      return box;
    }
  }
  return null;
}
Board.prototype.findTwinLine = function(twin) {
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if ($ne$(line, twin) && $eq$(line.box1, twin.box1) && $eq$(line.box2, twin.box2)) {
      return line;
    }
  }
  return null;
}
Board.prototype._lineContains = function(point) {
  var delta = _PointFactoryProvider.Point$factory((8), (8));
  var $$list = this.lines;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var line = $$i.next();
    if (line.contains(point, delta)) {
      return line;
    }
  }
}
Board.prototype._boxExists = function(box) {
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var b = $$i.next();
    if ($eq$(b, box)) {
      return true;
    }
  }
  return false;
}
Board.prototype.onMouseDown = function(e) {
  var clickedOnBox = false;
  var $$list = this.boxes;
  for (var $$i = $$list.iterator(); $$i.hasNext(); ) {
    var box = $$i.next();
    if (box.contains(e.offsetX, e.offsetY)) {
      clickedOnBox = true;
      break;
    }
  }
  if (!clickedOnBox) {
    if (this.toolBar.isSelectToolOn()) {
      var clickedPoint = _PointFactoryProvider.Point$factory(e.offsetX, e.offsetY);
      var line = this._lineContains(clickedPoint);
      if (line != null) {
        line.toggleSelection();
      }
      else {
        this.deselect();
      }
    }
    else if (this.toolBar.isBoxToolOn()) {
      var box = new Box(this, e.offsetX, e.offsetY, (120), (120));
      if (e.offsetX + box.width > this.get$width()) {
        box.x = this.get$width() - box.width - (1);
      }
      if (e.offsetY + box.height > this.get$height()) {
        box.y = this.get$height() - box.height - (1);
      }
      this.boxes.add(box);
    }
    else if (this.toolBar.isLineToolOn()) {
      if (this.beforeLastBoxClicked != null && this.lastBoxClicked != null && this._boxExists(this.beforeLastBoxClicked) && this._boxExists(this.lastBoxClicked) && this.countLinesBetween(this.beforeLastBoxClicked, this.lastBoxClicked) < (2)) {
        var line = new Line(this, this.beforeLastBoxClicked, this.lastBoxClicked);
        this.lines.add(line);
      }
    }
    this.toolBar.backToFixedTool();
  }
}
Board.prototype.get$onMouseDown = function() {
  return this.onMouseDown.bind(this);
}
Board.prototype.clear$0 = Board.prototype.clear;
// ********** Code for ToolBar **************
function ToolBar(board) {
  var $this = this; // closure support
  this.board = board;
  this.selectButton = get$$document().query("#select");
  this.boxButton = get$$document().query("#box");
  this.lineButton = get$$document().query("#line");
  this.selectButton.get$on().get$click().add$1((function (e) {
    $this.onTool((1));
  })
  );
  this.selectButton.get$on().get$doubleClick().add((function (e) {
    $this.onTool((1));
    $this._fixedTool = (1);
  })
  , false);
  this.boxButton.get$on().get$click().add$1((function (e) {
    $this.onTool((2));
  })
  );
  this.boxButton.get$on().get$doubleClick().add((function (e) {
    $this.onTool((2));
    $this._fixedTool = (2);
  })
  , false);
  this.lineButton.get$on().get$click().add$1((function (e) {
    $this.onTool((3));
  })
  );
  this.lineButton.get$on().get$doubleClick().add((function (e) {
    $this.onTool((3));
    $this._fixedTool = (3);
  })
  , false);
  this.onTool((1));
  this._fixedTool = (1);
  this.canvasWidthInput = get$$document().query("#canvasWidth");
  this.canvasHeightInput = get$$document().query("#canvasHeight");
  this.canvasWidthInput.valueAsNumber = this.board.get$width();
  this.canvasWidthInput.get$on().get$input().add((function (e) {
    $this.board.set$width($this.canvasWidthInput.valueAsNumber);
  })
  , false);
  this.canvasHeightInput.valueAsNumber = this.board.get$height();
  this.canvasHeightInput.get$on().get$input().add((function (e) {
    $this.board.set$height($this.canvasHeightInput.valueAsNumber);
  })
  , false);
  this.boxNameInput = get$$document().query("#boxName");
  this.boxNameInput.get$on().get$input().add((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      var boxName = $this.boxNameInput.value.trim();
      if (boxName != "") {
        var otherBox = $this.board.findBox(boxName);
        if (otherBox == null) {
          box.set$title(boxName);
        }
      }
    }
  })
  , false);
  this.boxEntryCheckbox = get$$document().query("#boxEntry");
  this.boxEntryCheckbox.get$on().get$change().add((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      box.entry = $this.boxEntryCheckbox.checked;
    }
  })
  , false);
  this.itemNameInput = get$$document().query("#itemName");
  this.itemNameInput.get$on().get$input().add((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        var itemName = $this.itemNameInput.value.trim();
        if (itemName != "") {
          var otherItem = box.findItem(itemName);
          if (otherItem == null) {
            $this.currentItem.name = itemName;
          }
        }
        $this.itemNameInput.select();
      }
    }
  })
  , false);
  this.itemCategoryOption = get$$document().query("#itemCategory");
  this.itemCategoryOption.get$on().get$change().add((function (e) {
    if ($this.currentItem != null) {
      $this.currentItem.category = $this.itemCategoryOption.value;
      $this.itemNameInput.select();
    }
  })
  , false);
  this.itemTypeOption = get$$document().query("#itemType");
  this.itemTypeOption.get$on().get$change().add((function (e) {
    if ($this.currentItem != null) {
      $this.currentItem.type = $this.itemTypeOption.value;
      $this.itemNameInput.select();
    }
    $this.itemInitInput.value = "";
  })
  , false);
  this.itemInitInput = get$$document().query("#itemInit");
  this.itemInitInput.get$on().get$input().add((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        $this.currentItem.init = $this.itemInitInput.value.trim();
        $this.itemNameInput.select();
      }
    }
  })
  , false);
  this.addItemButton = get$$document().query("#addItem");
  this.addItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      var itemName = $this.itemNameInput.value.trim();
      if (itemName != "") {
        var otherItem = box.findItem(itemName);
        if (otherItem == null) {
          var item = new Item(box, itemName, $this.itemCategoryOption.value);
          item.type = $this.itemTypeOption.value;
          item.init = $this.itemInitInput.value.trim();
        }
      }
    }
  })
  );
  this.getItemButton = get$$document().query("#getItem");
  this.getItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      var item = box.findItem($this.itemNameInput.value);
      if (item != null) {
        $this.currentItem = item;
        $this.itemNameInput.value = item.name;
        $this.itemCategoryOption.value = item.category;
        $this.itemTypeOption.value = item.type;
        $this.itemInitInput.value = item.init;
        $this.itemNameInput.select();
      }
      else {
        $this.currentItem = null;
      }
    }
  })
  );
  this.getNextItemButton = get$$document().query("#getNextItem");
  this.getNextItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        var nextItem = box.findNextItem($this.currentItem);
        if (nextItem != null) {
          $this.currentItem = nextItem;
          $this.itemNameInput.value = nextItem.name;
          $this.itemCategoryOption.value = nextItem.category;
          $this.itemTypeOption.value = nextItem.type;
          $this.itemInitInput.value = nextItem.init;
          $this.itemNameInput.select();
        }
        else {
          $this.currentItem = null;
          $this.itemNameInput.value = "";
          $this.itemCategoryOption.value = "attribute";
          $this.itemTypeOption.value = "String";
          $this.itemInitInput.value = "";
        }
      }
      else {
        if (!box.items.isEmpty()) {
          var firstItem = box.findFirstItem();
          $this.currentItem = firstItem;
          $this.itemNameInput.value = firstItem.name;
          $this.itemCategoryOption.value = firstItem.category;
          $this.itemTypeOption.value = firstItem.type;
          $this.itemInitInput.value = firstItem.init;
          $this.itemNameInput.select();
        }
      }
    }
  })
  );
  this.getPreviousItemButton = get$$document().query("#getPreviousItem");
  this.getPreviousItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        var previousItem = box.findPreviousItem($this.currentItem);
        if (previousItem != null) {
          $this.currentItem = previousItem;
          $this.itemNameInput.value = previousItem.name;
          $this.itemCategoryOption.value = previousItem.category;
          $this.itemTypeOption.value = previousItem.type;
          $this.itemInitInput.value = previousItem.init;
          $this.itemNameInput.select();
        }
        else {
          $this.currentItem = null;
          $this.itemNameInput.value = "";
          $this.itemCategoryOption.value = "attribute";
          $this.itemTypeOption.value = "String";
          $this.itemInitInput.value = "";
        }
      }
      else {
        if (!box.items.isEmpty()) {
          var lastItem = box.findLastItem();
          $this.currentItem = lastItem;
          $this.itemNameInput.value = lastItem.name;
          $this.itemCategoryOption.value = lastItem.category;
          $this.itemTypeOption.value = lastItem.type;
          $this.itemInitInput.value = lastItem.init;
          $this.itemNameInput.select();
        }
      }
    }
  })
  );
  this.moveDownItemButton = get$$document().query("#moveDownItem");
  this.moveDownItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        var nextItem = box.findNextItem($this.currentItem);
        if (nextItem != null) {
          var nextSequence = nextItem.sequence;
          var currentSequence = $this.currentItem.sequence;
          $this.currentItem.sequence = nextSequence;
          nextItem.sequence = currentSequence;
          $this.itemNameInput.select();
        }
        else {
          $this.currentItem = null;
          $this.itemNameInput.value = "";
          $this.itemCategoryOption.value = "attribute";
          $this.itemTypeOption.value = "String";
          $this.itemInitInput.value = "";
        }
      }
    }
  })
  );
  this.moveUpItemButton = get$$document().query("#moveUpItem");
  this.moveUpItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        var previousItem = box.findPreviousItem($this.currentItem);
        if (previousItem != null) {
          var previousSequence = previousItem.sequence;
          var currentSequence = $this.currentItem.sequence;
          $this.currentItem.sequence = previousSequence;
          previousItem.sequence = currentSequence;
          $this.itemNameInput.select();
        }
        else {
          $this.currentItem = null;
          $this.itemNameInput.value = "";
          $this.itemCategoryOption.value = "attribute";
          $this.itemTypeOption.value = "String";
          $this.itemInitInput.value = "";
        }
      }
    }
  })
  );
  this.removeItemButton = get$$document().query("#removeItem");
  this.removeItemButton.get$on().get$click().add$1((function (e) {
    var box = $this.board.lastBoxSelected;
    if (box != null) {
      if ($this.currentItem != null) {
        if (box.removeItem($this.currentItem)) {
          $this.currentItem = null;
          $this.itemNameInput.value = "";
          $this.itemCategoryOption.value = "attribute";
          $this.itemTypeOption.value = "String";
          $this.itemInitInput.value = "";
        }
      }
    }
  })
  );
  this.lineOption = get$$document().query("#lineCategory");
  this.lineOption.get$on().get$change().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.set$category($this.lineOption.value);
    }
  })
  , false);
  this.lineInternalCheckbox = get$$document().query("#lineInternal");
  this.lineInternalCheckbox.get$on().get$change().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.internal = $this.lineInternalCheckbox.checked;
    }
  })
  , false);
  this.line12Box1Label = get$$document().query("#line12Box1");
  this.line12Box2Label = get$$document().query("#line12Box2");
  this.line12MinInput = get$$document().query("#line12Min");
  this.line12MinInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box1box2Min = $this.line12MinInput.value.trim();
    }
  })
  , false);
  this.line12MaxInput = get$$document().query("#line12Max");
  this.line12MaxInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box1box2Max = $this.line12MaxInput.value.trim();
    }
  })
  , false);
  this.line12IdCheckbox = get$$document().query("#line12Id");
  this.line12IdCheckbox.get$on().get$change().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      if (line.box1box2Min == "1" && line.box1box2Max == "1") {
        line.box1box2Id = $this.line12IdCheckbox.checked;
      }
      else {
        $this.line12IdCheckbox.checked = false;
        line.box1box2Id = false;
      }
    }
  })
  , false);
  this.line12NameInput = get$$document().query("#line12Name");
  this.line12NameInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box1box2Name = $this.line12NameInput.value.trim();
    }
  })
  , false);
  this.line21Box2Label = get$$document().query("#line21Box2");
  this.line21Box1Label = get$$document().query("#line21Box1");
  this.line21MinInput = get$$document().query("#line21Min");
  this.line21MinInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box2box1Min = $this.line21MinInput.value.trim();
    }
  })
  , false);
  this.line21MaxInput = get$$document().query("#line21Max");
  this.line21MaxInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box2box1Max = $this.line21MaxInput.value.trim();
    }
  })
  , false);
  this.line21IdCheckbox = get$$document().query("#line21Id");
  this.line21IdCheckbox.get$on().get$change().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      if (line.box2box1Min == "1" && line.box2box1Max == "1") {
        line.box2box1Id = $this.line21IdCheckbox.checked;
      }
      else {
        $this.line21IdCheckbox.checked = false;
        line.box2box1Id = false;
      }
    }
  })
  , false);
  this.line21NameInput = get$$document().query("#line21Name");
  this.line21NameInput.get$on().get$input().add((function (e) {
    var line = $this.board.lastLineSelected;
    if (line != null) {
      line.box2box1Name = $this.line21NameInput.value.trim();
    }
  })
  , false);
}
ToolBar.prototype.bringSelectedBox = function() {
  var box = this.board.lastBoxSelected;
  if (box != null) {
    this.boxNameInput.value = box.get$title();
    this.boxEntryCheckbox.checked = box.entry;
  }
}
ToolBar.prototype.bringSelectedLine = function() {
  var line = this.board.lastLineSelected;
  if (line != null) {
    this.lineOption.value = line.get$category();
    this.lineInternalCheckbox.checked = line.internal;
    this.line12Box1Label.set$text(line.box1.get$title());
    this.line12Box2Label.set$text(line.box2.get$title());
    this.line12MinInput.value = line.box1box2Min;
    this.line12MaxInput.value = line.box1box2Max;
    this.line12IdCheckbox.checked = line.box1box2Id;
    this.line12NameInput.value = line.box1box2Name;
    this.line21Box2Label.set$text(line.box2.get$title());
    this.line21Box1Label.set$text(line.box1.get$title());
    this.line21MinInput.value = line.box2box1Min;
    this.line21MaxInput.value = line.box2box1Max;
    this.line21IdCheckbox.checked = line.box2box1Id;
    this.line21NameInput.value = line.box2box1Name;
  }
}
ToolBar.prototype.onTool = function(tool) {
  this._onTool = tool;
  if (this._onTool == (1)) {
    this.selectButton.get$style().set$borderColor("#000000");
    this.boxButton.get$style().set$borderColor("#999493");
    this.lineButton.get$style().set$borderColor("#999493");
  }
  else if (this._onTool == (2)) {
    this.selectButton.get$style().set$borderColor("#999493");
    this.boxButton.get$style().set$borderColor("#000000");
    this.lineButton.get$style().set$borderColor("#999493");
  }
  else if (this._onTool == (3)) {
    this.selectButton.get$style().set$borderColor("#999493");
    this.boxButton.get$style().set$borderColor("#999493");
    this.lineButton.get$style().set$borderColor("#000000");
  }
}
ToolBar.prototype.isSelectToolOn = function() {
  if (this._onTool == (1)) {
    return true;
  }
  return false;
}
ToolBar.prototype.isBoxToolOn = function() {
  if (this._onTool == (2)) {
    return true;
  }
  return false;
}
ToolBar.prototype.isLineToolOn = function() {
  if (this._onTool == (3)) {
    return true;
  }
  return false;
}
ToolBar.prototype.backToFixedTool = function() {
  this.onTool(this._fixedTool);
}
ToolBar.prototype.backToSelectAsFixedTool = function() {
  this.onTool((1));
  this._fixedTool = (1);
}
// ********** Code for Line **************
function Line(board, box1, box2) {
  this.internal = true;
  this._twin1 = false;
  this._twin2 = false;
  this._selected = false;
  this._hidden = false;
  this.board = board;
  this.box1 = box1;
  this.box2 = box2;
  this.set$category("relationship");
  this.draw();
}
Line.prototype.draw = function() {
  if (!this.isHidden()) {
    this.board.context.beginPath();
    if (this.get$twin1()) {
      this.board.context.moveTo(this.box1.twin1().x, this.box1.twin1().y);
      this.board.context.lineTo(this.box2.twin1().x, this.box2.twin1().y);
    }
    else if (this.get$twin2()) {
      this.board.context.moveTo(this.box1.twin2().x, this.box1.twin2().y);
      this.board.context.lineTo(this.box2.twin2().x, this.box2.twin2().y);
    }
    else if (this.get$reflexive()) {
      this.board.context.moveTo(this.box1.center().x, this.box1.center().y);
      this.board.context.lineTo(this.box1.reflexive1().x, this.box2.reflexive1().y);
      this.board.context.lineTo(this.box1.reflexive2().x, this.box2.reflexive2().y);
      this.board.context.lineTo(this.box1.center().x, this.box2.center().y);
    }
    else {
      this.board.context.moveTo(this.box1.center().x, this.box1.center().y);
      this.board.context.lineTo(this.box2.center().x, this.box2.center().y);
    }
    if (this.isSelected()) {
      this.board.context.lineWidth = (3);
    }
    else {
      this.board.context.lineWidth = (1);
    }
    var box1box2MinMaxPoint;
    var box2box1MinMaxPoint;
    var box1box2NamePoint;
    var box2box1NamePoint;
    if (this.get$reflexive()) {
      box1box2MinMaxPoint = this.calculateMinMaxPoint1(this.box1);
      box2box1MinMaxPoint = this.calculateMinMaxPoint2(this.box1);
      box1box2NamePoint = this.calculateNamePoint1(this.box1);
      box2box1NamePoint = this.calculateNamePoint2(this.box1);
    }
    else {
      box1box2MinMaxPoint = this.calculateMinMaxPointCloseToBeginBox(this.box1, this.box2);
      box2box1MinMaxPoint = this.calculateMinMaxPointCloseToBeginBox(this.box2, this.box1);
      box1box2NamePoint = this.calculateNamePointCloseToBeginBox(this.box1, this.box2);
      box2box1NamePoint = this.calculateNamePointCloseToBeginBox(this.box2, this.box1);
    }
    var box1box2MinMax = $add$($add$(this.box1box2Min, ".."), this.box1box2Max);
    var box2box1MinMax = $add$($add$(this.box2box1Min, ".."), this.box2box1Max);
    if (this.box1box2Id) {
      this.board.context.font = $add$("bold italic " + (12), "px sans-serif");
    }
    else if (this.box1box2Min != "0") {
      this.board.context.font = $add$("bold " + (12), "px sans-serif");
    }
    else {
      this.board.context.font = $add$("" + (12), "px sans-serif");
    }
    this.board.context.fillText(box1box2MinMax, box1box2MinMaxPoint.x, box1box2MinMaxPoint.y);
    this.board.context.fillText(this.box1box2Name, box1box2NamePoint.x, box1box2NamePoint.y);
    if (this.box2box1Id) {
      this.board.context.font = $add$("bold italic " + (12), "px sans-serif");
    }
    else if (this.box2box1Min != "0") {
      this.board.context.font = $add$("bold " + (12), "px sans-serif");
    }
    else {
      this.board.context.font = $add$("" + (12), "px sans-serif");
    }
    this.board.context.fillText(box2box1MinMax, box2box1MinMaxPoint.x, box2box1MinMaxPoint.y);
    this.board.context.fillText(this.box2box1Name, box2box1NamePoint.x, box2box1NamePoint.y);
    if (!this.internal) {
      this.board.context.strokeStyle = "#999493";
    }
    else {
      this.board.context.strokeStyle = "#000000";
    }
    this.board.context.stroke();
    this.board.context.closePath();
  }
}
Line.prototype.get$category = function() {
  return this._category;
}
Line.prototype.set$category = function(category) {
  this._category = category;
  if (category == "relationship") {
    this.box1box2Name = "";
    this.box1box2Min = "0";
    this.box1box2Max = "N";
    this.box1box2Id = false;
    this.box2box1Name = "";
    this.box2box1Min = "1";
    this.box2box1Max = "1";
    this.box2box1Id = false;
    this._twin1 = false;
    this._twin2 = false;
  }
  else if (category == "inheritance") {
    this.box1box2Name = "as";
    this.box1box2Min = "0";
    this.box1box2Max = "1";
    this.box1box2Id = false;
    this.box2box1Name = "is";
    this.box2box1Min = "1";
    this.box2box1Max = "1";
    this.box2box1Id = true;
    this._twin1 = false;
    this._twin2 = false;
  }
  else if (category == "reflexive") {
    this.box2 = this.box1;
    this.internal = true;
    this.box1box2Name = this._putInEnglishPlural(this.box1.get$title().toLowerCase());
    this.box1box2Min = "0";
    this.box1box2Max = "N";
    this.box1box2Id = false;
    this.box2box1Name = this.box1.get$title().toLowerCase();
    this.box2box1Min = "0";
    this.box2box1Max = "1";
    this.box2box1Id = false;
    this._twin1 = false;
    this._twin2 = false;
  }
  else if (category == "twin") {
    var twinLine = this.board.findTwinLine(this);
    if (twinLine != null) {
      if (twinLine.get$twin()) {
        this._twin1 = false;
        this._twin2 = true;
        twinLine.set$twin1(true);
        twinLine.set$twin2(false);
      }
      else {
        this._twin1 = true;
        this._twin2 = false;
      }
    }
  }
}
Line.prototype.get$reflexive = function() {
  return this.get$category() == "reflexive";
}
Line.prototype.get$twin = function() {
  return this.get$category() == "twin";
}
Line.prototype.get$twin1 = function() {
  return this._twin1;
}
Line.prototype.set$twin1 = function(twin1) {
  this._twin1 = twin1;
}
Line.prototype.get$twin2 = function() {
  return this._twin2;
}
Line.prototype.set$twin2 = function(twin2) {
  this._twin2 = twin2;
}
Line.prototype.toJson = function() {
  var lineMap = new HashMapImplementation_dart_core_String$Object();
  lineMap.$setindex("box1Name", this.box1.get$title());
  lineMap.$setindex("box2Name", this.box2.get$title());
  lineMap.$setindex("category", this.get$category());
  lineMap.$setindex("internal", this.internal);
  lineMap.$setindex("box1box2Name", this.box1box2Name);
  lineMap.$setindex("box1box2Min", this.box1box2Min);
  lineMap.$setindex("box1box2Max", this.box1box2Max);
  lineMap.$setindex("box1box2Id", this.box1box2Id);
  lineMap.$setindex("box2box1Name", this.box2box1Name);
  lineMap.$setindex("box2box1Min", this.box2box1Min);
  lineMap.$setindex("box2box1Max", this.box2box1Max);
  lineMap.$setindex("box2box1Id", this.box2box1Id);
  return lineMap;
}
Line.prototype.select = function() {
  this._selected = true;
  this.board.lastLineSelected = this;
  this.board.toolBar.bringSelectedLine();
}
Line.prototype.deselect = function() {
  this._selected = false;
  this.board.lastLineSelected = null;
}
Line.prototype.toggleSelection = function() {
  if (this.isSelected()) {
    this.deselect();
  }
  else {
    this.select();
  }
}
Line.prototype.isSelected = function() {
  return this._selected;
}
Line.prototype.hide = function() {
  var $0;
  return (this._hidden = ($0 = true), $0);
}
Line.prototype.show = function() {
  var $0;
  return (this._hidden = ($0 = false), $0);
}
Line.prototype.isHidden = function() {
  return this._hidden;
}
Line.prototype._putInEnglishPlural = function(text) {
  var plural = null;
  try {
    if (text.length > (0)) {
      var lastCharacterString = text.substring(text.length - (1), text.length);
      if (lastCharacterString == "x") {
        plural = $add$(text, "es");
      }
      else if (lastCharacterString == "z") {
        plural = $add$(text, "zes");
      }
      else if (lastCharacterString == "y") {
        var withoutLast = this._dropEnd(text, lastCharacterString);
        plural = $add$(withoutLast, "ies");
      }
      else {
        plural = $add$(text, "s");
      }
    }
  } catch (e) {
    e = _toDartException(e);
    if (!(e && e.is$Exception())) throw e;
    return text;
  }
  return plural;
}
Line.prototype._dropEnd = function(text, end) {
  var withoutEnd = text;
  var endPosition = text.lastIndexOf(end);
  if (endPosition > (0)) {
    withoutEnd = text.substring((0), endPosition);
  }
  return withoutEnd;
}
Line.prototype.contains = function(point, delta) {
  if (this.box1.contains(point.x, point.y) || this.box2.contains(point.x, point.y)) {
    return false;
  }
  var pointDif = _PointFactoryProvider.Point$factory((0), (0));
  var inLineRectX, inLineRectY, inLineRect;
  var coord;
  var beginPoint;
  var endPoint;
  if (this.get$twin1()) {
    beginPoint = this.box1.twin1();
    endPoint = this.box2.twin1();
  }
  else if (this.get$twin2()) {
    beginPoint = this.box1.twin2();
    endPoint = this.box2.twin2();
  }
  else if (this.get$reflexive()) {
    beginPoint = this.box1.reflexive1();
    endPoint = this.box1.reflexive2();
  }
  else {
    beginPoint = this.box1.center();
    endPoint = this.box2.center();
  }
  pointDif.x = endPoint.x - beginPoint.x;
  pointDif.y = endPoint.y - beginPoint.y;
  if (pointDif.x > (0)) {
    inLineRectX = (point.x >= (beginPoint.x - delta.x)) && (point.x <= (endPoint.x + delta.x));
  }
  else {
    inLineRectX = (point.x >= (endPoint.x - delta.x)) && (point.x <= (beginPoint.x + delta.x));
  }
  if (pointDif.y > (0)) {
    inLineRectY = (point.y >= (beginPoint.y - delta.y)) && (point.y <= (endPoint.y + delta.y));
  }
  else {
    inLineRectY = (point.y >= (endPoint.y - delta.y)) && (point.y <= (beginPoint.y + delta.y));
  }
  inLineRect = inLineRectX && inLineRectY;
  if (!inLineRect) {
    return false;
  }
  if ((pointDif.x == (0)) || (pointDif.y == (0))) {
    return true;
  }
  if (pointDif.x.abs() > pointDif.y.abs()) {
    coord = beginPoint.y + (((point.x - beginPoint.x) * pointDif.y) / pointDif.x) - point.y;
    return coord.abs() <= delta.y;
  }
  else {
    coord = beginPoint.x + (((point.y - beginPoint.y) * pointDif.x) / pointDif.y) - point.x;
    return coord.abs() <= delta.x;
  }
}
Line.prototype.calculateMinMaxPointCloseToBeginBox = function(beginBox, endBox) {
  var x = (0);
  var y = (0);
  var lineBeginPoint;
  var lineEndPoint;
  if (this.get$twin1()) {
    lineBeginPoint = beginBox.twin1();
    lineEndPoint = endBox.twin1();
  }
  else if (this.get$twin2()) {
    lineBeginPoint = beginBox.twin2();
    lineEndPoint = endBox.twin2();
  }
  else {
    lineBeginPoint = beginBox.center();
    lineEndPoint = endBox.center();
  }
  var beginPoint = beginBox.getIntersectionPoint(lineBeginPoint, lineEndPoint);
  var endPoint = endBox.getIntersectionPoint(lineEndPoint, lineBeginPoint);
  var x1 = beginPoint.x;
  var y1 = beginPoint.y;
  var x2 = endPoint.x;
  var y2 = endPoint.y;
  if (x1 <= x2) {
    x = x1 + (1) * ((x2 - x1) / (8));
    if (y1 <= y2) {
      y = y1 + (1) * ((y2 - y1) / (8));
    }
    else {
      y = y2 + (7) * ((y1 - y2) / (8));
    }
  }
  else {
    x = x2 + (7) * ((x1 - x2) / (8));
    if (y1 <= y2) {
      y = y1 + (1) * ((y2 - y1) / (8));
    }
    else {
      y = y2 + (7) * ((y1 - y2) / (8));
    }
  }
  return _PointFactoryProvider.Point$factory(x, y);
}
Line.prototype.calculateNamePointCloseToBeginBox = function(beginBox, endBox) {
  if (this.get$reflexive()) {
    return _PointFactoryProvider.Point$factory(beginBox.reflexive1().x + (30), beginBox.reflexive1().y + (30));
  }
  var x = (0);
  var y = (0);
  var lineBeginPoint;
  var lineEndPoint;
  if (this.get$twin1()) {
    lineBeginPoint = beginBox.twin1();
    lineEndPoint = endBox.twin1();
  }
  else if (this.get$twin2()) {
    lineBeginPoint = beginBox.twin2();
    lineEndPoint = endBox.twin2();
  }
  else {
    lineBeginPoint = beginBox.center();
    lineEndPoint = endBox.center();
  }
  var beginPoint = beginBox.getIntersectionPoint(lineBeginPoint, lineEndPoint);
  var endPoint = endBox.getIntersectionPoint(lineEndPoint, lineBeginPoint);
  var x1 = beginPoint.x;
  var y1 = beginPoint.y;
  var x2 = endPoint.x;
  var y2 = endPoint.y;
  if (x1 <= x2) {
    x = x1 + (3) * ((x2 - x1) / (8));
    if (y1 <= y2) {
      y = y1 + (3) * ((y2 - y1) / (8));
    }
    else {
      y = y2 + (5) * ((y1 - y2) / (8));
    }
  }
  else {
    x = x2 + (5) * ((x1 - x2) / (8));
    if (y1 <= y2) {
      y = y1 + (3) * ((y2 - y1) / (8));
    }
    else {
      y = y2 + (5) * ((y1 - y2) / (8));
    }
  }
  return _PointFactoryProvider.Point$factory(x, y);
}
Line.prototype.calculateMinMaxPoint1 = function(box) {
  return _PointFactoryProvider.Point$factory(box.reflexive1().x - (30), box.reflexive1().y + (30));
}
Line.prototype.calculateMinMaxPoint2 = function(box) {
  return _PointFactoryProvider.Point$factory(box.reflexive2().x + (10), box.reflexive2().y + (30));
}
Line.prototype.calculateNamePoint1 = function(box) {
  return _PointFactoryProvider.Point$factory(box.reflexive1().x - (20), box.reflexive1().y - (20));
}
Line.prototype.calculateNamePoint2 = function(box) {
  return _PointFactoryProvider.Point$factory(box.reflexive2().x + (10), box.reflexive2().y);
}
// ********** Code for MenuBar **************
function MenuBar(board) {
  var $this = this; // closure support
  this.board = board;
  this.modelNameInput = get$$document().query("#model-name");
  this.openModelButton = get$$document().query("#open-model");
  this.saveModelButton = get$$document().query("#save-model");
  this.closeModelButton = get$$document().query("#close-model");
  this.deleteSelectionButton = get$$document().query("#delete-selection");
  this.selectAllButton = get$$document().query("#select-all");
  this.selectBoxesButton = get$$document().query("#select-boxes");
  this.selectLinesButton = get$$document().query("#select-lines");
  this.selectBoxLinesButton = get$$document().query("#select-box-lines");
  this.selectLinesBetweenBoxesButton = get$$document().query("#select-lines-between-boxes");
  this.increaseSelectionHeightButton = get$$document().query("#increase-selection-height");
  this.decreaseSelectionHeightButton = get$$document().query("#decrease-selection-height");
  this.increaseSelectionWidthButton = get$$document().query("#increase-selection-width");
  this.decreaseSelectionWidthButton = get$$document().query("#decrease-selection-width");
  this.increaseSelectionSizeButton = get$$document().query("#increase-selection-size");
  this.decreaseSelectionSizeButton = get$$document().query("#decrease-selection-size");
  this.hideSelectionButton = get$$document().query("#hide-selection");
  this.hideNonSelectionButton = get$$document().query("#hide-non-selection");
  this.showHiddenButton = get$$document().query("#show-hidden");
  this.createBoxesInDiagonalButton = get$$document().query("#create-boxes-in-diagonal");
  this.createBoxesAsTilesButton = get$$document().query("#create-boxes-as-tiles");
  this.openModelButton.get$on().get$click().add$1((function (e) {
    var modelName = $this.modelNameInput.value.trim();
    $this.board.openModel(modelName);
  })
  );
  this.saveModelButton.get$on().get$click().add$1((function (e) {
    var modelName = $this.modelNameInput.value.trim();
    $this.board.saveModel(modelName);
  })
  );
  this.closeModelButton.get$on().get$click().add$1((function (e) {
    $this.modelNameInput.value = "";
    $this.board.closeModel();
  })
  );
  this.deleteSelectionButton.get$on().get$click().add$1((function (e) {
    $this.board.deleteSelection();
  })
  );
  this.selectAllButton.get$on().get$click().add$1((function (e) {
    $this.board.select();
  })
  );
  this.selectBoxesButton.get$on().get$click().add$1((function (e) {
    $this.board.selectBoxes();
  })
  );
  this.selectLinesButton.get$on().get$click().add$1((function (e) {
    $this.board.selectLines();
  })
  );
  this.selectBoxLinesButton.get$on().get$click().add$1((function (e) {
    $this.board.selectBoxLines();
  })
  );
  this.selectLinesBetweenBoxesButton.get$on().get$click().add$1((function (e) {
    $this.board.selectLinesBetweenBoxes();
  })
  );
  this.increaseSelectionHeightButton.get$on().get$click().add$1((function (e) {
    $this.board.increaseHeightOfSelectedBoxes();
  })
  );
  this.decreaseSelectionHeightButton.get$on().get$click().add$1((function (e) {
    $this.board.decreaseHeightOfSelectedBoxes();
  })
  );
  this.increaseSelectionWidthButton.get$on().get$click().add$1((function (e) {
    $this.board.increaseWidthOfSelectedBoxes();
  })
  );
  this.decreaseSelectionWidthButton.get$on().get$click().add$1((function (e) {
    $this.board.decreaseWidthOfSelectedBoxes();
  })
  );
  this.increaseSelectionSizeButton.get$on().get$click().add$1((function (e) {
    $this.board.increaseSizeOfSelectedBoxes();
  })
  );
  this.decreaseSelectionSizeButton.get$on().get$click().add$1((function (e) {
    $this.board.decreaseSizeOfSelectedBoxes();
  })
  );
  this.hideSelectionButton.get$on().get$click().add$1((function (e) {
    $this.board.hideSelection();
  })
  );
  this.hideNonSelectionButton.get$on().get$click().add$1((function (e) {
    $this.board.hideNonSelection();
  })
  );
  this.showHiddenButton.get$on().get$click().add$1((function (e) {
    $this.board.showHidden();
  })
  );
  this.createBoxesInDiagonalButton.get$on().get$click().add$1((function (e) {
    $this.board.createBoxesInDiagonal();
  })
  );
  this.createBoxesAsTilesButton.get$on().get$click().add$1((function (e) {
    $this.board.createBoxesAsTiles();
  })
  );
}
// ********** Code for Item **************
function Item(box, name, category) {
  this.init = "";
  this.box = box;
  this.name = name;
  this.category = category;
  this.sequence = this.box.findLastItemSequence() + (10);
  this.box.items.add(this);
}
Item.prototype.toJson = function() {
  var itemMap = new HashMapImplementation_dart_core_String$Object();
  itemMap.$setindex("sequence", this.sequence);
  itemMap.$setindex("name", this.name);
  itemMap.$setindex("category", this.category);
  itemMap.$setindex("type", this.type);
  itemMap.$setindex("init", this.init);
  return itemMap;
}
// ********** Code for JsonPanel **************
function JsonPanel(board) {
  var $this = this; // closure support
  this.board = board;
  this.modelJsonTextArea = get$$document().query("#modelJson");
  this.fromModelToJsonButton = get$$document().query("#fromModelToJson");
  this.fromModelToJsonButton.get$on().get$click().add$1((function (e) {
    $this.modelJsonTextArea.value = $this.board.toJson();
    $this.modelJsonTextArea.select();
  })
  );
  this.fromJsonToModelButton = get$$document().query("#fromJsonToModel");
  this.fromJsonToModelButton.get$on().get$click().add$1((function (e) {
    $this.board.fromJson($this.modelJsonTextArea.value);
  })
  );
  this.clearButton = get$$document().query("#clearJson");
  this.clearButton.get$on().get$click().add$1((function (e) {
    $this.clear();
  })
  );
}
JsonPanel.prototype.clear = function() {
  this.modelJsonTextArea.value = "";
}
JsonPanel.prototype.clear$0 = JsonPanel.prototype.clear;
// ********** Code for PngPanel **************
function PngPanel(board) {
  var $this = this; // closure support
  this.board = board;
  this.modelImage = get$$document().query("#modelImage");
  this.fromModelToPngButton = get$$document().query("#fromModelToPng");
  this.fromModelToPngButton.get$on().get$click().add$1((function (e) {
    $this.modelImage.src = $this.board.canvas.toDataURL("image/png");
    $this.show();
  })
  );
  this.clearButton = get$$document().query("#clearImage");
  this.clearButton.get$on().get$click().add$1((function (e) {
    $this.hide();
  })
  );
}
PngPanel.prototype.hide = function() {
  this.modelImage.set$hidden(true);
}
PngPanel.prototype.show = function() {
  this.modelImage.set$hidden(false);
}
// ********** Code for top level **************
function main() {
  var canvas = get$$document().query("#canvas");
  var board = new Board(canvas);
}
// 200 dynamic types.
// 218 types
// 19 !leaf
function $dynamicSetMetadata(inputTable) {
  // TODO: Deal with light isolates.
  var table = [];
  for (var i = 0; i < inputTable.length; i++) {
    var tag = inputTable[i][0];
    var tags = inputTable[i][1];
    var map = {};
    var tagNames = tags.split('|');
    for (var j = 0; j < tagNames.length; j++) {
      map[tagNames[j]] = true;
    }
    table.push({tag: tag, tags: tags, map: map});
  }
  $dynamicMetadata = table;
}
(function(){
  var v0/*SVGTextPositioningElement*/ = 'SVGTextPositioningElement|SVGAltGlyphElement|SVGTRefElement|SVGTSpanElement|SVGTextElement';
  var v1/*SVGAnimationElement*/ = 'SVGAnimationElement|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement|SVGAnimateTransformElement|SVGSetElement';
  var v2/*SVGComponentTransferFunctionElement*/ = 'SVGComponentTransferFunctionElement|SVGFEFuncAElement|SVGFEFuncBElement|SVGFEFuncGElement|SVGFEFuncRElement';
  var v3/*SVGGradientElement*/ = 'SVGGradientElement|SVGLinearGradientElement|SVGRadialGradientElement';
  var v4/*SVGTextContentElement*/ = [v0/*SVGTextPositioningElement*/,'SVGTextContentElement|SVGTextPathElement'].join('|');
  var v5/*HTMLHtmlElement*/ = 'HTMLHtmlElement|SVGDocument';
  var v6/*HTMLMediaElement*/ = 'HTMLMediaElement|HTMLAudioElement|HTMLVideoElement';
  var v7/*SVGElement*/ = [v1/*SVGAnimationElement*/,v2/*SVGComponentTransferFunctionElement*/,v3/*SVGGradientElement*/,v4/*SVGTextContentElement*/,'SVGElement|SVGAElement|SVGAltGlyphDefElement|SVGAltGlyphItemElement|SVGCircleElement|SVGClipPathElement|SVGCursorElement|SVGDefsElement|SVGDescElement|SVGEllipseElement|SVGFEBlendElement|SVGFEColorMatrixElement|SVGFEComponentTransferElement|SVGFECompositeElement|SVGFEConvolveMatrixElement|SVGFEDiffuseLightingElement|SVGFEDisplacementMapElement|SVGFEDistantLightElement|SVGFEDropShadowElement|SVGFEFloodElement|SVGFEGaussianBlurElement|SVGFEImageElement|SVGFEMergeElement|SVGFEMergeNodeElement|SVGFEMorphologyElement|SVGFEOffsetElement|SVGFEPointLightElement|SVGFESpecularLightingElement|SVGFESpotLightElement|SVGFETileElement|SVGFETurbulenceElement|SVGFilterElement|SVGFontElement|SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement|SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGlyphRefElement|SVGHKernElement|SVGImageElement|SVGLineElement|SVGMPathElement|SVGMarkerElement|SVGMaskElement|SVGMetadataElement|SVGMissingGlyphElement|SVGPathElement|SVGPatternElement|SVGPolygonElement|SVGPolylineElement|SVGRectElement|SVGSVGElement|SVGScriptElement|SVGStopElement|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTitleElement|SVGUseElement|SVGVKernElement|SVGViewElement'].join('|');
  var v8/*DocumentFragment*/ = 'DocumentFragment|ShadowRoot';
  var v9/*Element*/ = [v5/*HTMLHtmlElement*/,v6/*HTMLMediaElement*/,v7/*SVGElement*/,'Element|HTMLElement|HTMLAnchorElement|HTMLAppletElement|HTMLAreaElement|HTMLBRElement|HTMLBaseElement|HTMLBaseFontElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement|HTMLContentElement|HTMLDListElement|HTMLDetailsElement|HTMLDirectoryElement|HTMLDivElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormElement|HTMLFrameElement|HTMLFrameSetElement|HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|IntentionallyInvalid|HTMLIFrameElement|HTMLImageElement|HTMLInputElement|HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMarqueeElement|HTMLMenuElement|HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement|HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLShadowElement|HTMLSourceElement|HTMLSpanElement|HTMLStyleElement|HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableElement|HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTitleElement|HTMLTrackElement|HTMLUListElement|HTMLUnknownElement'].join('|');
  var v10/*AbstractWorker*/ = 'AbstractWorker|SharedWorker|Worker';
  var v11/*Node*/ = [v8/*DocumentFragment*/,v9/*Element*/,'Node|Attr|CharacterData|Comment|Text|CDATASection|HTMLDocument|DocumentType|Entity|EntityReference|Notation|ProcessingInstruction'].join('|');
  var table = [
    // [dynamic-dispatch-tag, tags of classes implementing dynamic-dispatch-tag]
    ['AbstractWorker', v10/*AbstractWorker*/]
    , ['DOMTokenList', 'DOMTokenList|DOMSettableTokenList']
    , ['HTMLHtmlElement', v5/*HTMLHtmlElement*/]
    , ['DocumentFragment', v8/*DocumentFragment*/]
    , ['HTMLMediaElement', v6/*HTMLMediaElement*/]
    , ['SVGAnimationElement', v1/*SVGAnimationElement*/]
    , ['SVGComponentTransferFunctionElement', v2/*SVGComponentTransferFunctionElement*/]
    , ['SVGGradientElement', v3/*SVGGradientElement*/]
    , ['SVGTextPositioningElement', v0/*SVGTextPositioningElement*/]
    , ['SVGTextContentElement', v4/*SVGTextContentElement*/]
    , ['SVGElement', v7/*SVGElement*/]
    , ['Element', v9/*Element*/]
    , ['EntrySync', 'EntrySync|DirectoryEntrySync|FileEntrySync']
    , ['Node', v11/*Node*/]
    , ['EventTarget', [v10/*AbstractWorker*/,v11/*Node*/,'EventTarget|DOMApplicationCache|EventSource|MessagePort|Notification|SVGElementInstance|WebSocket|DOMWindow|XMLHttpRequest|XMLHttpRequestUpload'].join('|')]
    , ['HTMLCollection', 'HTMLCollection|HTMLOptionsCollection']
    , ['Uint8Array', 'Uint8Array|Uint8ClampedArray']
  ];
  $dynamicSetMetadata(table);
})();
//  ********** Globals **************
function $static_init(){
}
var const$0000 = Object.create(_DeletedKeySentinel.prototype, {});
var const$0001 = Object.create(NoMoreElementsException.prototype, {});
var const$0002 = Object.create(EmptyQueueException.prototype, {});
var const$0003 = Object.create(UnsupportedOperationException.prototype, {_message: {"value": "", writeable: false}});
var const$0004 = Object.create(UnsupportedOperationException.prototype, {_message: {"value": "TODO(jacobr): should we impl?", writeable: false}});
var const$0005 = Object.create(NotImplementedException.prototype, {});
var $globals = {};
$static_init();
main();
